User`s guide
The C MEX S-Function SimStruct
3-107
ssGetInputPortRealSignalPtrs
(S,inputPortIdx)
Canbeusedinanysimulationloop(seep.3-16)
S-function routine to access an input port signal. The
input port index starts at 0 and ends at the number of
input ports minus 1. This macro returns a pointer to an
array of pointers to the
real_T input signal elements.
Thelengthofthearrayofpointersisequaltothewidth
of the input port. For example, to read all input port
signals, use:
int_T i,j;
int_T nInputPorts = ssGetNumInputPorts(S);
for (i = 0; i < nInputPorts; i++) {
InputRealPtrsType uPtrs =
ssGetInputPortRealSignal(S,i);
int_T nu = ssGetInputPortWidth(S,i);
for (j = 0; j < nu; j++) {
SomeFunctionToUseInputSignalElement(*uPtrs
[j]);
}
}
ssGetInputPortSampleTime
(S,inputPortIdx)
Canbeusedinanyroutine(exceptmdlInitializeSizes)
to determine the sample time of an input port. This
should only be used if you have specified the sample
timesasport-based.
ssGetInputPortOffsetTime
(S,inputPortIdx)
Canbeusedinanyroutine(exceptmdlInitializeSizes)
to determine the offset time of an input port. This should
only be used if you have specified the sample times as
port-based.
Table 3-7: Input and Output Port Signal SimStruct Macros (Continued)
Macro Description