ssGetDTypeIdFromMxArray
Get the data type of an S-function parameter
Syntax
DTypeId ssGetDTypeIdFromMxArray(const mxArray *m)
Arguments
m
MATLAB® array that represents the parameter.
Returns
The data type ID of an S-function parameter represented by a MATLAB array. Returns INVALID_DTYPE_ID
if the MATLAB data type does not map to any built-in Simulink® data type ID.
Description
This function returns an enumerated type that represents the data type. The
enumerated type DTypeId
is defined in
simstruc_types.h
. The following table shows the equivalency
of Simulink, MATLAB, and C data types.
Simulink Data Type DTypeId | Simulink Data Type DTypeId Index | MATLAB Data Type mxClassID | C Data Type |
---|---|---|---|
SS_DOUBLE | 0 | mxDOUBLE_CLASS | real_T |
SS_SINGLE | 1 | mxSINGLE_CLASS | real32_T |
SS_INT8 | 2 | mxINT8_CLASS | int8_T |
SS_UINT8 | 3 | mxUINT8_CLASS | uint8_T |
SS_INT16 | 4 | mxINT16_CLASS | int16_T |
SS_UINT16 | 5 | mxUINT16_CLASS | uint16_T |
SS_INT32 | 6 | mxINT32_CLASS | int32_T |
SS_UINT32 | 7 | mxUINT32_CLASS | uint32_T |
SS_BOOLEAN | 8 | mxUINT8_CLASS+ logical | boolean_T |
If a MATLAB data type, for example mxSTRUCT_CLASS
, does not map
to any Simulink data type, the return value is INVALID_DTYPE_ID
.
Otherwise the return value is one of the enum
values in
DTypeId
. For example, for mxUINT16_CLASS
,
the return value is SS_UINT16
.
Note
Use ssGetSFcnParam
to get the array that represents the
parameter.
Languages
C, C++
Examples
See the S-function sfun_dtype_param.c
used in sfcndemo_dtype_param
to learn how to use data typed
parameters in an S-function.
Version History
Introduced before R2006a