Products & Services Solutions Academia Support User Community Company

Learn more about Simulink   

mdlSetInputPortComplexSignal - Set the numeric types (real, complex, or inherited) of the signals accepted by an input port

Required

No

C Syntax

#define MDL_SET_INPUT_PORT_COMPLEX_SIGNAL
void mdlSetInputPortComplexSignal(SimStruct *S, int_T port, 
 CSignal_T csig)

C Arguments

S

SimStruct representing an S-Function block.

port

Index of a port.

csig

Numeric type of signal, either COMPLEX_NO (real) or COMPLEX_YES (complex).

M Syntax

SetInputPortComplexSignal(s, port, csig)

M Arguments

s

Instance of Simulink.MSFcnRunTimeBlock class representing the Level-2 M-File S-Function block.

port

Integer value specifying index of port to be set.

csig

Integer value specifying whether the port accepts real (false or 0) or complex (true or 1) signals.

Description

The Simulink engine calls this routine to set the input port numeric type for inputs that have this attribute set to COMPLEX_INHERITED. The input csig is the proposed numeric type for this input port. This method is only valid for simulation. C MEX S-functions must enclosed this method in a #if defined(MATLAB_MEX_FILE) statement.

The S-function must check whether the proposed numeric type is a valid type for the specified port. If it is valid, a C MEX S-function sets the numeric type of the specified input port using ssSetInputPortComplexSignal. Otherwise, it reports an error using ssSetErrorStatus.

Level-2 M-file S-functions set the numeric type of the specified input port using the line

s.InputPort(port).Complexity = csig;

The S-function can also set the numeric types of other input and output ports with inherited numeric types. The engine reports an error if the S-function changes the numeric type of a port whose numeric type is known.

If the S-function does not implement this routine, the engine assumes that the S-function accepts a real or complex signal and sets the input port numeric type to the specified value.

The engine calls this method until all input ports with inherited numeric types have their numeric types specified.

C Example

See matlabroot/toolbox/simulink/simdemos/simfeatures/src/ sdotproduct.c for an example of how to use this function.

Languages

C, C++, M

See Also

ssSetErrorStatus, ssSetInputPortComplexSignal

  


Related Products & Applications

Learn more about Simulink through this collection of videos, articles, technical literature and the Getting Started with Simulink Guide.

 © 1984-2009- The MathWorks, Inc.    -   Site Help   -   Patents   -   Trademarks   -   Privacy Policy   -   Preventing Piracy   -   RSS