Hi,
I have implemented a masked subsystem with a variable number of Inports by replacing unneeded inputs by Ground blocks. The connections to the inner blocks of the subsystem remain intact. I outline the contents of the subsystem below. The inports are labeled by their name followed by the port index in parenthesis which denotes the order of appearance to the outside of the block.
|----------------| In1(1) -----> |:1 | In2(2) -----> |:2 Inner block | In3(3) -----> |:3 | In4(4) -----> |:4 | |----------------|
Assuming In1 is not needed the subsystem looks like this:
|----------------| Ground -----> |:1 | In2(1) -----> |:2 Inner block | In3(2) -----> |:3 | In4(3) -----> |:4 | |----------------|
All fine, however when I re-enable the disabled port the index of In1 is obviously wrong because the newly added inport assumes the next free port index.
|----------------| In1(4) -----> |:1 | In2(1) -----> |:2 Inner block | In3(2) -----> |:3 | In4(3) -----> |:4 | |----------------|
To avoid confusion I would like to restore the original port indices to match the names like in the very first figure.
I tried to use
set_param('In1', 'Port', '1');
but get a "??? Invalid Simulink object specifier." error.
Thanks for all replies!
Best Answer