Default Methods
Enumeration classes have the following default methods:methods('WeekDays')
Methods for class WeekDays:
WeekDays char intersect ne setxor strcmpi strncmp union
cellstr eq ismember setdiff strcmp string strncmpiThe WeekDays method converts char vectors, a cell array of char vectors, or string
array elements to enumerations.Other methods behave similarly to the equivalent function when used with enumerations.
For information on a specific method, see the documentation for that function.Convert Enumeration Member to Characters
Conversion to char is useful because you can define enumeration members with
descriptive names. For example:today = WeekDays.Friday;
['Today is ',char(today)]ans =Today is FridayConvert Enumeration Array to Cell Array of char Vectors
Use cellstr to convert an enumeration array to a cell array of char vectors.ca = cellstr([WeekDays.Tuesday,WeekDays.Thursday]);
class(ca)ans =cellBoth cells in the cell array contain char vectors:class([ca{1:2}])14 Enumerations