How to create dynamic goto tag names in Simulink?
24 ビュー (過去 30 日間)
古いコメントを表示
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 件のコメント
回答 (1 件)
Sebastian Castro
2015 年 4 月 9 日
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
参考
カテゴリ
Help Center および File Exchange で Event Functions についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!