Define enumerated data type
Simulink.defineIntEnumType(
ClassName
, CellOfEnums
, IntValues
)
Simulink.defineIntEnumType(ClassName
, CellOfEnums
, IntValues
,
'Description', ClassDesc
)
Simulink.defineIntEnumType(ClassName
, CellOfEnums
, IntValues
,
'DefaultValue', DefValue
)
Simulink.defineIntEnumType(ClassName
, CellOfEnums
, IntValues
,
'DataScope', ScopeSelection
)
Simulink.defineIntEnumType(ClassName
, CellOfEnums
, IntValues
,
'HeaderFile', FileName
)
Simulink.defineIntEnumType(ClassName
, CellOfEnums
, IntValues
,
'AddClassNameToEnumNames', Flag
)
Simulink.defineIntEnumType(ClassName
, CellOfEnums
, IntValues
,
'StorageType', DataType
)
Simulink.defineIntEnumType(
defines
an enumeration named ClassName
, CellOfEnums
, IntValues
)ClassName
with enumeration
values specified with CellOfEnums
and underlying
numeric values specified by IntValues
.
Simulink.defineIntEnumType(
defines
the enumeration with a description (character vector).ClassName
, CellOfEnums
, IntValues
,
'Description', ClassDesc
)
Simulink.defineIntEnumType(
defines
a default value for the enumeration, which is one of the character
vectors you specify for ClassName
, CellOfEnums
, IntValues
,
'DefaultValue', DefValue
)CellOfEnums
.
Simulink.defineIntEnumType(
specifies
whether the data type definition should be imported from, or exported
to, a header file during code generation.ClassName
, CellOfEnums
, IntValues
,
'DataScope', ScopeSelection
)
Simulink.defineIntEnumType(
specifies
the name of a header file containing the enumeration class definition
for use in code generated from a model.ClassName
, CellOfEnums
, IntValues
,
'HeaderFile', FileName
)
Simulink.defineIntEnumType(
specifies
whether the code generator applies the class name as a prefix to the
enumeration values that you specify for ClassName
, CellOfEnums
, IntValues
,
'AddClassNameToEnumNames', Flag
)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(
specifies
the data type used to store the enumerations’ underlying integer
values in code generated from a model.ClassName
, CellOfEnums
, IntValues
,
'StorageType', DataType
)
|
The name of the enumerated data type. | ||||||||
|
A cell array of character vectors that defines the enumerations for the data type. | ||||||||
|
An array of numeric values that correspond to enumerations of the data type. | ||||||||
|
Specifies a character vector that describes the enumeration data type. | ||||||||
|
Specifies the default enumeration value. | ||||||||
|
Specifies a character vector naming the header file that is to contain the data type definition. By default, the generated | ||||||||
|
Specifies whether the data type definition should be imported from, or exported to, a header file during code generation.
| ||||||||
|
A logical flag that specifies whether code generator applies the class name as a prefix to the enumerations. | ||||||||
|
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: |
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:
Simulink.defineIntEnumType('BasicColors', ... {'Red', 'Yellow', 'Blue'}, ... [0;1;2], ... 'Description', 'Basic colors', ... 'DefaultValue', 'Blue', ... 'HeaderFile', 'mybasiccolors.h', ... 'DataScope', 'Exported', ... 'AddClassNameToEnumNames', true, ... 'StorageType', 'int16');