Change port numnber set_param('In1', 'Port', 8)

Hello,
is it possible to change the number of the port? I've tried set_param('In1', 'Port', 8) but I get the Error
"Invalid setting in Outport block 'In1' for parameter 'Port'"
Changing the number in the dialog does work, so is there a way to change it in the command line?
Thanks a lot.

Antworten (1)

Fangjun Jiang
Fangjun Jiang am 27 Nov. 2011

1 Stimme

You need to use the full path of the block and set string format for the port number. Also, you might need to consider duplicated port number.
f14;
set_param('f14/Nz Pilot (g)','port','5');

2 Kommentare

Kaustubha Govind
Kaustubha Govind am 28 Nov. 2011
I think Simulink takes care of duplicated port numbers by re-ordering the other port numbers.
Fangjun Jiang
Fangjun Jiang am 28 Nov. 2011
Yes. What I meant was to be careful. Changing a port number from 1 to 8 might affect the existing port number 8, if it exists.

Melden Sie sich an, um zu kommentieren.

Tags

Gefragt:

am 27 Nov. 2011

Community Treasure Hunt

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

Start Hunting!

Translated by