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.

Answers (1)

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 Comments

I think Simulink takes care of duplicated port numbers by re-ordering the other port numbers.
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.

Sign in to comment.

Tags

Asked:

on 27 Nov 2011

Community Treasure Hunt

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

Start Hunting!