My Simulink model contains a Level 2 MATLAB S-Function block. The number of input and output ports are dynamically updated based on mask parameters.
The issue I am running into occurs when saving and loading the Simulink block in a library or model causes it appear invalid.
Even though the commands
get_param(gcb, 'NumInputPorts')get_param(gcb, 'NumOutputPorts')
output the value I've inputted in my dialog mask parameter, the block that is drawn only contains 1 input and 1 output (the defaults).
If I manually set the number of input and output ports from the MATLAB Command Window as follows
set_param(gcb, 'NumInputPorts'
the block gets updated correctly. Why does this happen?
Best Answer