Main Content

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_DOUBLE0mxDOUBLE_CLASSreal_T
SS_SINGLE1mxSINGLE_CLASSreal32_T
SS_INT82mxINT8_CLASSint8_T
SS_UINT83mxUINT8_CLASSuint8_T
SS_INT164mxINT16_CLASSint16_T
SS_UINT165mxUINT16_CLASSuint16_T
SS_INT326mxINT32_CLASSint32_T
SS_UINT327mxUINT32_CLASSuint32_T
SS_BOOLEAN8mxUINT8_CLASS+ logicalboolean_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