Products & Services Solutions Academia Support User Community Company

Learn more about Simulink   

ssGetOutputPortRealSignal - 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.

port

Index of an output port.

Returns

A contiguous real_T vector of length equal to the width of the output port.

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.

Languages

C, C++

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();
  }
}

See the S-function matlabroot/toolbox/simulink/simdemos/simfeatures/src/sfun_atol.c used in sfcndemo_sfun_atol.mdl for a complete example that uses this function.

See Also

ssGetInputPortRealSignalPtrs

  


Related Products & Applications

Learn more about Simulink through this collection of videos, articles, technical literature and the Getting Started with Simulink Guide.

 © 1984-2009- The MathWorks, Inc.    -   Site Help   -   Patents   -   Trademarks   -   Privacy Policy   -   Preventing Piracy   -   RSS