How to create dynamic goto tag names in Simulink?
20 views (last 30 days)
Show older comments
I am developing some libraries and I want that most of the signals of the components comunicate with other components without visual links, so that I am using global GOTOs. My idea is that the final user will be able to specify the FROMs of a component in the component mask. (In anyone know other way to do that without global GOTOs it would be great).
The problem is that if I insert two times the same component from the library I will get two GOTOs with the same name. As the name of the component automatically changes ("Component", "Component1", "Component2"...) i would like to add a refference to the component's name in the GOTO tag name, something like:
Tag name: strcat(gcb,'_goto_name')
where gcb is a function that gets the block's path.
Is that possible? How could I do it? If not I think I could also activate a callback with code to do that everytime the name of a system changes...
Thank you all
1 Comment
Answers (1)
Sebastian Castro
on 9 Apr 2015
To do this, you can right-click the block and select Properties, then go to the Callback tab. In one of those callbacks, probably "NameChangeFcn", you can add the following code:
blkName = get_param(gcb,'Name');
set_param(gcb,'GotoTag',[blkName '_goto_name']);
- Sebastian
See Also
Categories
Find more on Event Functions in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!