Writing S-Functions    
ssSetOutputPortReusable

Specify that an output port is reusable.

Syntax

Arguments

S
   SimStruct representing an S-Function block.

outputPortIdx
   Index of the output port whose reusability is being set.

Value specifying reusability of the port.

Description

Use in mdlInitializeSizes (after ssSetNumOutputPorts) to specify whether output ports have a test point. This macro can take one of two values:

In Simulink, reusable signals share the same memory space. This macro allows an S-function to tell Simulink that it can store the S-function's outputs temporarily in memory used for storing other signals in the model. This reuse results in less memory use during simulation and more efficiency in the Real-Time Workshop generated code.

When you mark an output port as reusable, your S-function must update the output once in mdlOutputs. It cannot expect the previous output value to be persistent.

By default, the output port signals are not reusable. This forces Simulink's simulation engine (and the Real-Time Workshop) to allocate global memory for these output port signals. Hence this memory is only written to by your S-function and persists between model execution steps.

Languages

C

See Also

ssSetNumOutputPorts, ssSetInputPortReusable


  ssSetOutputPortOffsetTime ssSetOutputPortSampleTime