matlab.metadata.EnumerationMember - Describe enumeration member of MATLAB class - MATLAB (original) (raw)
Main Content
Namespace: matlab.metadata
Superclasses: matlab.metadata.MetaData
Describe enumeration member of MATLAB class
Renamed from meta.EnumeratedValue
in R2024a
Description
The matlab.metadata.EnumerationMember
class contains information about enumeration members defined by MATLABĀ® classes. The properties of a matlab.metadata.EnumerationMember
object correspond to the attributes of the enumeration member being described.
All matlab.metadata.EnumerationMember
properties are read-only. Query thematlab.metadata.EnumerationMember
object to obtain information about the enumeration member it describes.
The matlab.metadata.EnumerationMember
class is a handle class.
Class Attributes
Abstract | true |
---|---|
ConstructOnLoad | true |
For information on class attributes, see Class Attributes.
Creation
Obtain a matlab.metadata.EnumerationMember
object from theEnumerationMemberList
property of amatlab.metadata.Class
object. EnumerationMemberList
is an array of matlab.metadata.EnumerationMember
instances, one per enumeration member.
Properties
Name of the enumeration member, returned as a character vector.
Short description of the enumeration member, returned as a character vector. For user-defined classes, the text for this property comes from code comments in the enumeration definition. If there are no comments, the property returns an empty character vector. For more information on how to include help text for your enumerations, see Custom Help Text.
Detailed description of the enumeration member, returned as a character vector. For user-defined classes, the text for this property comes from code comments in the enumeration definition. If there are no comments, the property returns an empty character vector. For more information on how to include help text for your enumerations, see Custom Help Text.
Value of enumeration member attribute Hidden
, returned as a logical value.
Examples
List Enumeration Member Names
Use the EnumerationMemberList
property of amatlab.metadata.Class
instance to get the names of the enumeration members defined in the matlab.lang.OnOffSwitchState
enumeration class.
mc = ?matlab.lang.OnOffSwitchState; mc.EnumerationMemberList.Name
Version History
Introduced in R2009b
The namespace and class name of meta.EnumeratedValue
have been changed tomatlab.metadata.EnumerationMember
. The behavior remains the same.
MATLAB will continue to recognize the old metaclass names in most contexts. However, code that relies on string comparisons to identify metaclasses might need to be updated to continue to work as expected. For example, if mObj
in the example below is a matlab.metadata.EnumerationMember
instance, the code under thecase
statement for 'meta.EnumeratedValue'
does not execute because class(mObj)
returns'matlab.metadata.EnumerationMember'
.
switch class(mObj) case 'meta.EnumeratedValue' % code to execute if mObj is a meta.EnumeratedValue instance ... end
To ensure this code continues to work as intended, use an if
statement with isa
. The isa
command recognizes both the old and new names of the class.
if isa(mObj,'meta.EnumeratedValue') % code to execute if mObj is a % matlab.metadata.EnumerationMember instance else ... end
If compatibility with older releases of MATLAB is not a concern, you can update 'meta.EnumeratedValue'
to'matlab.metadata.EnumerationMember'
. However, continue to use the old name if your code needs to run on versions of MATLAB before R2024a.