Documentation

Simulink.data.getEnumTypeInfo

Get information about enumerated data type

Syntax

information = Simulink.data.getEnumTypeInfo(enumTypeName,infoRequest)

Description

example

information = Simulink.data.getEnumTypeInfo(enumTypeName,infoRequest) returns information about an enumerated data type enumTypeName.

Use this function only to return information about an enumerated data type. To customize an enumerated data type, for example, by specifying a default enumeration member or by controlling the scope of the type definition in generated code, see Customize Simulink Enumeration.

Examples

collapse all

Get the default enumeration member of an enumerated data type LEDcolor. Suppose LEDcolor defines two enumeration members, GREEN and RED, and uses GREEN as the default member.

Simulink.data.getEnumTypeInfo('LEDcolor','DefaultValue')
ans = 

    GREEN

For an enumerated data type LEDcolor, find out if generated code exports or imports the definition of the type to or from a header file.

Simulink.data.getEnumTypeInfo('LEDcolor','DataScope')
Simulink.data.getEnumTypeInfo('LEDcolor','HeaderFile')
ans =

Auto


ans =

     ''

Because DataScope is 'Auto' and HeaderFile is empty, generated code defines the enumerated data type LEDcolor in the header file model_types.h where model is the name of the model used to generate code.

Input Arguments

collapse all

Name of the target enumerated data type, specified as a character vector.

Example: 'myFirstEnumType'

Data Types: char

Information to return, specified as one of the character vector options in the table.

Specified valueInformation returnedExample return value
'DefaultValue'The default enumeration member, returned as an instance of the enumerated data type.enumMember1
'Description'The custom description of this data type, returned as a character vector. Returns an empty character vector if a description was not specified for the type.'My first enum type.'
'HeaderFile'The name of the custom header file that defines the data type in generated code, returned as a character vector. Returns an empty character vector if a header file was not specified for the type.'myEnumType.h'
'DataScope'Indication whether generated code imports or exports the definition of the data type. A return value of 'Auto' indicates generated code defines the type in the header file model_types.h or imports the definition from the header file identified by HeaderFile. A return value of 'Exported' or 'Imported' indicates generated code exports or imports the definition to or from the header file identified by HeaderFile.'Exported'
'StorageType'The integer data type used by generated code to store the numeric values of the enumeration members, returned as a character vector. Returns 'int' if you did not specify a storage type for the enumerated type, in which case generated code uses the native integer type of the hardware target.'int32'
'AddClassNameToEnumNames'Indication whether generated code prefixes the names of enumeration members with the name of the data type. Returned as true or false.true

Introduced in R2014b

Was this topic helpful?