mdlSetDefaultPortDimensionInfo function does not fully set the dimension
Show older comments
My mdlSetDefaultPortDimensionInfo function looks like this:
static void mdlSetDefaultPortDimensionInfo(SimStruct *S)
{
ssSetInputPortWidth(S, 0, 2);
ssSetOutputPortWidth(S, 0, 1);
}
The Simulink model is just a simple feed-through and looks like this:

When running the Simulink model I get the following error:
Error in default port dimensions function of S-function 'minimal_simulink/S-Function'. This function does not fully set the dimensions of output port 1
The mdloutputs function looks like this:
static void mdlOutputs(SimStruct *S, int_T tid)
{
const real_T *u0 = (const real_T*) ssGetInputPortSignal(S,0);
real_T *y0 = (real_T *)ssGetOutputPortRealSignal(S,0);
y0[0] = u0[0];
}
Although in the manual it's stated that the mdlSetDefaultPortDimensionInfo is not required my model does not work without it.
I would be glad if someone could help me to fix this error.
Answers (0)
Categories
Find more on Simulink Coder in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!