ans =
1
How to Create Enumeration Instances
When you first refer to an enumeration class that derives from a built-in class such as,
int32, MATLAB passes the input arguments associated with the enumeration members
to the superclass constructor. For example, referencing the Second Results member,
defined as:
Second (50)
means that MATLAB calls:
int32(50)
to initialize the int32 aspect of this Results object.
How to Alias Enumeration Names
Enumeration classes that derive from MATLAB built-in numeric and logical classes can
define more than one name for an underlying value. The first name in the enumeration
block with a given underlying value is the actual name for that underlying value and
subsequent names are aliases.
Specify aliased names with the same superclass constructor argument as the actual
name:
classdef Bool < logical
enumeration
No (0)
Yes (1)
off (0)
on (1)
end
end
For example, the actual name of an instance of the Bool.off enumeration member is No:
a = Bool.No
14 Enumerations