mdlSetDefaultPortDimensionInfo function does not fully set the dimension
显示 更早的评论
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.
回答(0 个)
类别
在 帮助中心 和 File Exchange 中查找有关 Simulink Coder 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!