Enumerated data is data that is restricted to a finite set of values. To use enumerated data in a System object™ in MATLAB® or Simulink®, you refer to them in your System object class definition and define your enumerated class in a separate class definition file.
For a System object that is used in MATLAB only, see Enumerations.
For a System object that is used in a MATLAB System block in Simulink, see Enumerated Data (Simulink)
Enumerations can derive from any integer type smaller than or equal to an int32
. For example,
classdef Bearing < uint8 enumeration North (0) East (90) South (180) West (270) end end
Enumerations can also derive from Simulink.IntEnumType
. You use this type of enumeration to add
attributes, such as custom headers, to the input or output of the MATLAB System block. See Use Enumerated Data in Simulink Models (Simulink).