Skip to Main Content Skip to Search
Product Documentation

mdlSetOutputPortDataType - Set the data type of the signals emitted by an output port

Required

No

C Syntax

#define MDL_SET_OUTPUT_PORT_DATA_TYPE
void mdlSetOutputPortDataType(SimStruct *S, int_T port,
 DTypeId id)

C Arguments

S

SimStruct representing an S-Function block.

port

Index of an output port.

id

Data type ID.

MATLAB Syntax

SetOutputPortDataType(s, port, id)

MATLAB Arguments

s

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

port

Integer value specifying index of port to be set.

id

Integer value specifying ID of port's data type. Use s.getDatatypeName(id) to get the data type's name.

Description

The Simulink engine calls this routine to set the data type of port when port has an inherited data type. The data type ID id is the proposed data type for this port. Data type IDs for the built-in data types can be found in simstruc_types.h. The S-function must check whether the specified data type is a valid data type for the specified port.

If it is a valid data type, a C MEX S-function sets the data type of port using ssSetOutputPortDataType. Otherwise, the S-function reports an error, using ssSetErrorStatus. This method is only valid for simulation. C MEX S-functions must enclose the method in a #if defined(MATLAB_MEX_FILE) statement.

Level-2 MATLAB S-functions set the data type of the output port using the line

s.OutputPort(port).DatatypeID = id;

The S-function can also set the data types of other input and output ports if their data types have not been set. The engine reports an error if the S-function changes the data type of a port whose data type has been set.

If the block does not implement this method, the engine assumes that the block supports any data type and sets the output port data type to the specified value.

The engine calls this method until all output ports with inherited data types have their data types specified.

Languages

C, C++, MATLAB

See Also

ssSetOutputPortDataType, ssSetErrorStatus

  


Related Products & Applications

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

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