Enumerations represent a fixed set of named values.
Enumerations help make your MATLAB® code more readable. In a
MATLAB Function block, enumeration
classes must derive from Simulink.IntEnumType
,
int8
, uint8
,
int16
, uint16
, or
int32
. If you use Simulink®
Coder™ to
generate C/C++ code, the enumeration class base type
determines how the enumeration is represented in the
generated code.
MATLAB Function | Include MATLAB code in models that generate embeddable C code |
Code Generation for Enumerations
Use enumerations in MATLAB code intended for code generation.
Add Enumerated Inputs, Outputs, and Parameters to a MATLAB Function Block
Use the Ports and Data Manager to specify enumerated types for MATLAB Function block inputs, outputs, and parameters.
Use Enumerations to Control an LED Display
Use enumerations in a MATLAB Function block that determines the color of an LED display.