| Writing S-Functions | ![]() |
Get a pointer to an output signal of type double (real_T).
Syntax
real_T *ssGetOutputPortRealSignal(SimStruct *S, int_T port)
Arguments
S
SimStruct representing an S-function block.
Description
Use in any simulation loop routine, mdlInitializeConditions, or mdlStart 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.
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();
}
}
Languages
See Also
ssGetInputPortRealSignalPtrs
| ssGetOutputPortOffsetTime | ssGetOutputPortReusable | ![]() |