Enumerazioni
Insieme fisso di nomi che rappresentano un unico tipo di valore
Utilizzare le enumerazioni per rappresentare un insieme fisso di valori nominati, dove tutti i valori sono dello stesso tipo. È possibile derivare le classi di enumerazione da altre classi, come i tipi numerici incorporati. I membri dell'enumerazione ereditano quindi le operazioni aritmetiche e di ordinamento della superclasse.
Funzioni
enumeration | Class enumeration members and names |
isenum | Determine if variable is enumeration |
Classi
matlab.metadata.EnumerationMember | Describe enumeration member of MATLAB class |
Argomenti
Definizione e utilizzo delle enumerazioni
- Named Values
Associate values with predefined names using constant properties or enumeration classes. - Define Enumeration Classes
Define enumeration classes by creating an enumeration block in theclassdef
file. - Refer to Enumerations
Refer to enumeration members using the class name and the member name. - Operations on Enumerations
Use logical, set membership, and string comparison operations on enumerations. - Enumeration Class Restrictions
Enumeration classes restrict certain aspects of their use and definition. - Mutable Handle vs. Immutable Value Enumeration Members
Use a handle enumeration to enumerate a set of objects whose state can change over time. Use a value enumeration to enumerate a set of abstract (and immutable) values. - Save and Load Enumerations
The type of enumeration class determines the information MATLAB® saves with the class. - Hide Enumeration Members
Hiding enumeration members enables you to replace enumeration names without creating incompatibilities.
Classi di enumerazione specializzate
- Enumerations Derived from Built-In Classes
Enumeration classes derived from built-in types inherit behaviors from these types. - Enumerations That Encapsulate Data
Define properties in an enumeration class to associate specific data with enumeration members. - Enumerations for Property Values
Use enumeration classes to restrict properties to a predefined set of values.