Simulink.defineIntEnumType(ClassName, CellOfEnums, IntValues,
'HeaderFile', FileName) specifies
the name of a header file containing the enumeration class definition
for use in code generated from a model.

Simulink.defineIntEnumType(ClassName, CellOfEnums, IntValues,
'AddClassNameToEnumNames', Flag) specifies
whether the code generator applies the class name as a prefix to the
enumeration values that you specify for CellOfEnums.
For Flag, specify true or false.
For example, if you specify true, the code generator
would use BasicColors.Red instead of Red to
represent an enumerated value.

Simulink.defineIntEnumType(ClassName, CellOfEnums, IntValues,
'StorageType', DataType) specifies
the data type used to store the enumerations’ underlying integer
values in code generated from a model.

Input Arguments

ClassName

The name of the enumerated data type.

CellOfEnums

A cell array of character vectors that defines the enumerations
for the data type.

IntValues

An array of numeric values that correspond to enumerations of
the data type.

'Description', ClassDesc

Specifies a character vector that describes the enumeration
data type.

'DefaultValue', DefValue

Specifies the default enumeration value.

'HeaderFile', FileName

Specifies a character vector naming the header file that is
to contain the data type definition.

By default, the generated #include directive
uses the preprocessor delimiter " instead of < and >.
To generate the directive #include <myTypes.h>,
specify FileName as '<myTypes.h>'.

'DataScope', 'Auto' | 'Exported' | 'Imported'

Specifies whether the data type definition should be imported
from, or exported to, a header file during code generation.

Value

Action

Auto (default)

If no value is specified for Headerfile,
export the type definition to model_types.h,
where model is the model
name.

If a value is specified for Headerfile,
import the data type definition from the specified header file.

Exported

Export the data type definition to a header file.

If
no value is specified for Headerfile, the header
file name defaults to type.h,
where type is the data
type name.

Imported

Import the data type definition from a header file.

If
no value is specified for Headerfile, the header
file name defaults to type.h,
where type is the data
type name.

'AddClassNameToEnumNames', Flag

A logical flag that specifies whether code generator applies
the class name as a prefix to the enumerations.

'StorageType', DataType

Specifies a character vector that identifies the data type used
to store the enumerations’ underlying integer values in generated
code. The following data types are supported: 'int8', 'int16', 'int32', 'uint8',
or 'uint16'.

Examples

Assume an external data dictionary includes the following enumeration:

BasicColors.Red(0), BasicColors.Yellow(1), BasicColors.Blue(2)

Import the enumeration class definition into the MATLAB® workspace
while specifying int16 as the underlying integer
data type for generated code: