Borrar filtros
Borrar filtros

Rename an inport and outport of Subsystem

30 visualizaciones (últimos 30 días)
Lucas S
Lucas S el 2 de Abr. de 2019
Respondida: Pruthvi G el 3 de Abr. de 2019
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 !

Respuestas (1)

Pruthvi G
Pruthvi G el 3 de Abr. de 2019
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

Categorías

Más información sobre Subsystems en Help Center y File Exchange.

Etiquetas

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by