This is machine translation

Translated by Microsoft
Mouseover text to see original. Click the button below to return to the English verison of the page.

Note: This page has been translated by MathWorks. Please click here
To view all translated materals including this page, select Japan from the country navigator on the bottom of this page.


Get a pointer to an output signal of type double (real_T)


real_T *ssGetOutputPortRealSignal(SimStruct *S, int_T port)



SimStruct representing an S-Function block.


Index of an output port.


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


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.

    Note   You cannot use ssGetOutputPortRealSignal anywhere except in mdlOutputs if you have specified that the output ports are reusable using ssSetOutputPortOptimOpts. For example, if the outputs have been specified as reusable with the SS_REUSABLE_AND_LOCAL flag, the mdlUpdate routine errors out when it tries to access output memory that is unavailable.


C, C++


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 sfun_atol.c used in sfcndemo_sfun_atol for a complete example that uses this function.

Introduced before R2006a

Was this topic helpful?