Why do I get a Port Width mismatch error in my CMEX S-function when using dynamically_sized for either my inputs or outputs? The other input is set to a fixed value. For example, in my Level 2 S-function I have the following:
if (!ssSetNumInputPorts(S, 1)) return; ssSetInputPortWidth(S, 0, DYNAMICALLY_SIZED); ssSetInputPortDirectFeedThrough(S, 0, 1);if (!ssSetNumOutputPorts(S, 2)) return; ssSetOutputPortWidth(S, 0, NOUTPUT); ssSetOutputPortWidth(S, 1, NOUTPUT);
where NOUTPUT was defined as 22.
However, when I run the model, I receive errors that look like the following:
--> Port width mismatch. Output Port 1 of 'untitled/Subsystem/In1' has a width of 12. --> Input Port 1 of 'untitled/Subsystem/S-function' has a width of 22
How can I get around this?
Best Answer