Specify the sizes of the work vectors and create the run-time parameters required by this C MEX S-function
#define MDL_SET_WORK_WIDTHS void mdlSetWorkWidths(SimStruct *S)
SimStruct representing an S-Function block.
The Simulink® engine calls this optional method to enable
this S-function to set the sizes of state and work vectors that it
needs to store global data and to create run-time parameters (see Create and Update S-Function Run-Time Parameters).
The engine invokes this method after it has determined the input port
width, output port width, and sample times of the S-function. This
allows the S-function to size the state and work vectors based on
the number and sizes of inputs and outputs and/or the number of sample
times. This method specifies the state and work vector sizes via the
A C-MEX S-function needs to implement this method only if it
does not know the sizes of all the work vectors it requires when the
engine invokes the function's
If this S-function implements
it should initialize the sizes of any work vectors that it needs to
even for those whose exact size it knows at that point. The S-function
should then specify the actual size in
This method is only valid for simulation, and must be enclosed in
#if defined(MATLAB_MEX_FILE) statement.