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 port

Description

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

In Simulink, reusable signals share the same memory space. When this macro is turned on, the output port signal to the S-function may be reused by other signals in the model. This reuse results in less memory use during Simulink 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