ssSetInputPortComplexSignal
Set the numeric type (real or complex) of an input port
Syntax
CSignal_T ssSetInputPortComplexSignal(SimStruct *S, int_T port, CSignal_T csig)
Arguments
S
SimStruct that represents an S-Function block.
port
Index of an input port.
csig
Numeric type of the signals accepted by
port
. Valid values areCOMPLEX_NO
(real signal),COMPLEX_YES
(complex signal), andCOMPLEX_INHERITED
(numeric type inherited from driving block).
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 the input
port numeric type. If the numeric type of the input port is inherited from the block
to which it is connected, set the numeric type to
COMPLEX_INHERITED
. In this case, the S-function must provide
mdlSetInputPortComplexSignal
and
mdlSetDefaultPortComplexSignals
methods to enable the numeric type to be set correctly during signal propagation.
The default numeric type of an input port is real
.
Languages
C, C++
Examples
Assume that an S-function has three input ports. The first input port accepts real (noncomplex) signals. The second input port accepts complex signals. The third port accepts signals of either type. The following example specifies the correct numeric type for each port.
ssSetInputPortComplexSignal(S, 0, COMPLEX_NO) ssSetInputPortComplexSignal(S, 1, COMPLEX_YES) ssSetInputPortComplexSignal(S, 2, COMPLEX_INHERITED)
See the S-function sfun_cplx.c
used in sfcndemo_cplx
for a complete example that uses this
function.
See Also
Version History
Introduced before R2006a