Enumerations Derived from Built-In Types
In this section...
“Subclassing Built-In Types” on page 14-28
“Derive Enumeration Class from Numeric Type” on page 14-28
“How to Alias Enumeration Names” on page 14-30
“Superclass Constructor Returns Underlying Value” on page 14-31
“Default Converter” on page 14-32
Subclassing Built-In Types
Enumeration classes can subclass MATLAB built-in classes. Deriving an enumeration
class from a built-in classes is useful to extend the usefulness of the enumeration
members.
- Enumeration inherit functionality from the built-in class.
- You can associate a numeric or logical value with enumeration members.
For a more basic discussion of enumeration classes, see “Define Enumeration Classes” on
page 14-5.
Derive Enumeration Class from Numeric Type
NoteEnumeration classes derived from built-in numeric and logical classes cannot
define properties.
If an enumeration class subclasses a built-in numeric class, the subclass inherits ordering
and arithmetic operations that you can apply to the enumerated names.
For example, the Results class subclasses the int32 built-in class. This class associates
an integer value with each of the four enumeration members — First, Second, Third,
and NoPoints.
classdef Results < int32
enumeration
First (100)
14 Enumerations