Main Content


Register a custom data type


DTypeId ssRegisterDataType(SimStruct *S, char *name)



SimStruct that represents an S-Function block.


Name of the custom data type.


The DTypeId associated with the registered data type. Otherwise, reports an error and returns INVALID_DTYPE_ID.


Register a custom data type. Each data type must be a valid MATLAB® identifier. That is, the first character is an alpha and all subsequent characters are alphanumeric or "_". The name length must be less than 32. Data types must be registered in mdlInitializeSizes.

If the registration is successful, the function returns the DataTypeId associated with the registered data type; otherwise, it reports an error and returns INVALID_DTYPE_ID.

After registering the data type, you must specify its size, using ssSetDataTypeSize.

For more information about using custom data types in S-functions, see Configure Custom Data Types.


You can call this function to get the data type ID associated with a registered data type. For a list of built-in values for the data type ID, see ssGetInputPortDataType.


C, C++


The following example registers a custom data type named Color.

DTypeId id = ssRegisterDataType(S, "Color");
if(id == INVALID_DTYPE_ID) return;

See Configure Custom Data Types for a more detailed example showing how to use this function.

Version History

Introduced before R2006a