Skip to Main Content Skip to Search
Product Documentation

ssRegisterDataType - Register a custom data type

Syntax

DTypeId ssRegisterDataType(SimStruct *S, char *name)

Arguments

S

SimStruct representing an S-Function block.

name

Name of the custom data type.

Returns

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

Description

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.

The Simulink Coder product does not support S-functions that contain custom data types. Attempting to generate code for a model that contains this macro results in an error.

Languages

C, C++

Example

The following example registers a custom data type named Color.

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

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

See Also

ssGetDataTypeId. ssGetDataTypeZero, ssGetNumDataTypes, ssSetDataTypeSize, ssSetDataTypeZero

  


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