User`s guide

The C MEX S-Function SimStruct
3-109
ssGetOutputPortOffsetTime
(S,outputPortIdx)
Canbeusedinanyroutine(exceptmdlInitializeSizes)
to determine the offset time of an output port. This
should only be used if you have specified port-based
sample times.
ssGetOutputPortRealSignal
(S,outputPortIdx)
Canbeusedinanysimulationlooproutine,
mdlInitializeConditions,ormdlStart to access an
output port signal where the output port index starts at
0 and must be less than the number of output ports. This
returns a contiguous
real_T vector of length equal to the
width of the output port. For example, to write to all
output ports, you would use:
int_T i,j;
int_T nOutputPorts = ssGetNumOutputPorts(S);
for (i = 0; i < nOutputPorts; i++) {
real_T *y = ssGetOutputPortRealSignal(S,i);
int_T ny = ssGetOutputPortWidth(S,i);
for (j = 0; j < ny; j++) {
y[j] = SomeFunctionToFillInOutput();
}
}
Table 3-8: Parameter SimStruct Macros
Macros Description
ssSetNumSFcnParams
(S,nSFcnParams)
Used in mdlInitializeSizes to set the number of S-function
parameters.
ssGetSFcnParamsCount
(S)
Used in mdlInitializeSizes t o get the number of parameters
entered by in the S-function block dialog box.
Table 3-7: Input and Output Port Signal SimStruct Macros (Continued)
Macro Description