Rename an inport and outport of Subsystem
30 ビュー (過去 30 日間)
古いコメントを表示
Hello !
I am parsing a text file with matlab and trying to create a Simulink model from Matlab.
new_system(link_NameValue);
add_block('simulink/Ports & Subsystems/Subsystem',[link_NameValue '/' link_NameValue]);
set_param(gcb,'Description',sprintf('%s ==> %s', link_SourceNameValue, link_TargetNameValue));
set_param('On_Off/On_Off/In1','Port number',link_SourcePortNameValue);
I would like to rename name of Input In1 and Output Out1 of the subsystem with some parsed value.
I have tried this but returned me :
Inport block does not have a parameter named 'Port number'
Tried also with 'port' instead of 'Port number' but returned me :
Port number specified in 'On_Off/On_Off/In1' is invalid. Port numbers must be positive integer
constants less than or equal to 65535.
Thanks for help in advance !
0 件のコメント
回答 (1 件)
Pruthvi G
2019 年 4 月 3 日
Use below code to Get what ever Output you wanted. If any further clarification needed ping me.
% Rename an inport and outport of Subsystem
link_NameValue = 'On_Off';
link_SourceNameValue = 'New Subsystem';
link_TargetNameValue = 'Subsystem Pruthvi';
new_system(link_NameValue);
open_system(link_NameValue)
add_block('simulink/Ports & Subsystems/Subsystem',[link_NameValue '/' link_NameValue]);
set_param(gcb,'Description',sprintf('%s ==> %s', link_SourceNameValue, link_TargetNameValue));
link_SourcePortNameValue = '1'; % Port number should be in Char.
Inport_name = 'Lucas_S';
set_param('On_Off/On_Off/In1','port',link_SourcePortNameValue); % Setting Port Number
set_param('On_Off/On_Off/In1','Name',Inport_name); % Stting Port Name
0 件のコメント
参考
カテゴリ
Help Center および File Exchange で Simulink Functions についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!