How to get names of input ports on simulink block?
7 ビュー (過去 30 日間)
古いコメントを表示
Is there a way to get the name of the input ports on a Simulink block? I don't mean the names of the signals coming into the block (which are fairly simple to get), but the names assigned to the inports themselves?
0 件のコメント
回答 (1 件)
Rajanya
2025 年 2 月 11 日 11:07
You can utilize the 'get_param' function on any custom Simulink block that contains Inports or Outports to obtain the handle for that block. With this handle, you can then use 'find_system' to identify all 'Inports' or 'Outports' and subsequently retrieve their names.
blockHandle=get_param(gcb,'Handle'); %set the current block appropriately
portHandle=find_system(blockHandle,'BlockType','Inport');
portNames = cellstr(get_param(portHandle, 'Name'));
For more information on 'get_param' and 'find_system', you can refer to their respective documentation pages by executing the following commands from MATLAB Command Window:
doc get_param
doc find_system
Thanks.
0 件のコメント
参考
カテゴリ
Help Center および File Exchange で Programmatic Model Editing についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!