Main Content

ssSetOutputPortComplexSignal

Set the numeric type (real or complex) of an output port

Syntax

CSignal_T ssSetOutputPortComplexSignal(SimStruct *S, input_T port,
 CSignal_T csig)

Arguments

S

SimStruct that represents an S-Function block.

port

Index of an output port.

csig

Numeric type of the signals emitted by port. Valid values are COMPLEX_NO (real signal), COMPLEX_YES (complex signal), and COMPLEX_INHERITED (dynamically determined).

Returns

1 (COMPLEX_YES), 0 (COMPLEX_NO), or -1 (COMPLEX_INHERITED) depending on the value specified by csig.

Description

Use this function in mdlInitializeSizes to initialize an output port numeric type. If the numeric type of the output port is determined dynamically, e.g., by a parameter setting, set the numeric type to COMPLEX_INHERITED. In this case, the S-function must provide mdlSetOutputPortComplexSignal and mdlSetDefaultPortComplexSignals methods to enable the numeric type to be set correctly during signal propagation. The default numeric type of an output port is real.

Languages

C, C++

Examples

Assume that an S-function has three output ports. The first output port emits real (noncomplex) signals. The second output port emits a complex signal. The third port emits signals of a type determined by a parameter setting. The following example specifies the correct numeric type for each port.

ssSetOutputPortComplexSignal(S, 0, COMPLEX_NO)
ssSetOutputPortComplexSignal(S, 1, COMPLEX_YES)
ssSetOutputPortComplexSignal(S, 2, COMPLEX_INHERITED)

See the S-function sfun_cplx.c used in sfcndemo_cplx and the S-function sdotproduct.c used in sfcndemo_sdotproduct for complete examples that use this function.

Version History

Introduced before R2006a