mdlSetDefa​ultPortDim​ensionInfo 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에 대해 자세히 알아보기

질문:

2016년 2월 10일

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by