Here is a sample workflow that I used to utilizecustom-defined enumeration classes as data types in Simulink via the “inport” block:
Define the enumeration class in a.m file (In this case, “WeekDays.m”)
classdef WeekDays < Simulink.IntEnumType
enumeration
Day1(0)
Day2(1)
Day3(2)
end
end
2. Using the block parameters dialog box of “inport” block, set “Data type” of the “inport” block under the “Signal Attributes” tabto “Enum: WeekDays”.
3. Use a“constant” block and set its value to WeekDays.Day2 to have Day2 displayed as the output.
4. The result is displayed using a display block
For more information, you can refer to this documentation: