User`s guide
Overview of the C MEX S-Function Routines
3-35
This is the code synopsis for mdSetOutputPortSampleTime:
#if defined(MDL_SET_OUTPUT_PORT_SAMPLE_TIME) && defined(MATLAB_MEX_FILE)
static void mdlSetOutputPortSampleTime(SimStruct *S,
int_T portIdx,
real_T sampleTime,
real_T offsetTime)
{
}
#endif /* MDL_SET_OUTPUT_PORT_SAMPLE_TIME */
See matlabrooot/simulink/src/sfun_multirate.c for an example.
mdlSetInputPortWidth
During vector-width propagation Simulink calls mdlSetInputPortWidth with
the candidate width for a dynamica l ly sized port. If the propose d width is
acceptable, the routine sets the actual port width using
ssSetInputPortWidth.
If the size is unacceptable an error is generated by
ssSetErrorStatus.Note
that any other dynamically sized input or output ports whose widths are
implicitlydefinedbythewidthofthegivenportcanalsohavetheirwidthsset
by calls to
ssSetInputPortWidth or ssSetOutputPortWidth.
The synopsis is:
#define MDL_SET_INPUT_PORT_WIDTH /* Change to #undef to remove function. */
#if defined(MDL_SET_INPUT_PORT_WIDTH) && defined(MATLAB_MEX_FILE)
void mdlSetInputPortWidth(SimStruct *S, int portIndex, int width)
{
}
#endif /* MDL_SET_INPUT_PORT_WIDTH */
For an example, see matlabroot/simulink/src/sfun_dynsize.c.
mdlSetOutputPortWidth
mdlSetOutputPortWidth works in the same way with output ports as
mdlSetInputPortWidth does with input ports.
The synopsis is:
#define MDL_SET_OUTPUT_PORT_WIDTH /* Change to #undef to remove function */
#if defined(MDL_SET_OUTPUT_PORT_WIDTH) && defined(MATLAB_MEX_FILE)
void mdlSetOutputPortWidth(SimStruct *S, int portIndex, int width)
{
}
#endif /* MDL_SET_OUTPUT_PORT_WIDTH */
For an example, see matlabroot/simulink/src/sfun_dynsize.c.