| Products & Services | Solutions | Academia | Support | User Community | Company |
| Download Product Updates | | | Get Pricing | | | Trial Software |
| Documentation → Simulink |
| Contents | Index |
| Learn more about Simulink |
No
#define MDL_SET_INPUT_PORT_DATA_TYPE
void mdlSetInputPortDataType(SimStruct *S, int_T port, DTypeId id)
SetInputPortDataType(s, port, id)
Instance of Simulink.MSFcnRunTimeBlock class representing the Level-2 M-File S-Function block.
Integer value specifying index of port to be set.
Integer value specifying ID of port's data type. Use s.getDatatypeName(id) to get the data type's name.
The Simulink engine calls this routine to set the data type of port when port has an inherited data type. The data type id is the proposed data type for this port. Data type IDs for the built-in data types can be found in matlabroot/simulink/include/simstruc_types.h. This method is only valid for simulation. C MEX S-functions must enclose this method in a #if defined(MATLAB_MEX_FILE) statement.
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-functions sets the data type of the input port using ssSetInputPortDataType. Otherwise, it reports an error using ssSetErrorStatus.
Level-2 M-file S-functions set the data type of the input port using the line
s.InputPort(port).DatatypeID = id;
The S-function can also set the data types of other input and output ports if they are unknown. 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 routine, the engine assumes that the block accepts any data type and sets the input port data type to the specified value.
The engine calls this method until all input ports with inherited data types have their data types specified.
C, C++, M
ssSetErrorStatus, ssSetInputPortDataType
![]() | mdlSetInputPortComplexSignal | mdlSetInputPortDimensionInfo | ![]() |

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 |