Products & Services Solutions Academia Support User Community Company

Learn more about Simulink   

ssGetOutputPortSignal - Get the vector of signal elements emitted by an output port

Syntax

void *ssGetOutputPortSignal(SimStruct *S, int_T port)

Arguments

S

SimStruct representing an S-Function block.

port

Index of an output port.

Returns

A pointer (void *) to the vector of signal elements output at the port specified by the index port.

Description

Use in any simulation loop routine, mdlInitializeConditions, or mdlStart to obtain a vector of signal elements emitted by an output port.

Languages

C, C++

Example

Assume that the output port data types are int16_T.

  nOutputPorts = ssGetNumOutputPorts(S);
  for (i = 0; i < nOutputPorts; i++) {
   	int16_T *y      = (int16_T *)ssGetOutputPortSignal(S,i);
	   int_T   ny      = ssGetOutputPortWidth(S,i);
 	  for (j = 0; j < ny; j++) {
  		SomeFunctionToFillInOutput(y[j]);
  	}
  }

See the S-function matlabroot/simulink/src/sfun_port_constant.c used in sfcndemo_port_constant.mdl for a complete example that uses this function.

See Also

ssGetOutputPortRealSignal

  


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