Documentation

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 representing an S-Function block.

port

Index of an output port.

csig

Numeric type of the signals emitted byport. Valid values areCOMPLEX_NO(real signal),COMPLEX_YES(complex signal), andCOMPLEX_INHERITED(dynamically determined).

Returns

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

Description

Use this function inmdlInitializeSizesto 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 toCOMPLEX_INHERITED. In this case, the S-function must providemdlSetOutputPortComplexSignalandmdlSetDefaultPortComplexSignalsmethods to enable the numeric type to be set correctly during signal propagation. The default numeric type of an output port isreal.

语言

C, C++

Example

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-functionsfun_cplx.cused insfcndemo_cplxand the S-functionsdotproduct.cused insfcndemo_sdotproductfor complete examples that use this function.

Introduced before R2006a