Documentation

meta.EnumeratedValue

描述枚举成员啊fMATLABclass

Description

Themeta.EnumeratedValueclass contains information about enumeration members defined by MATLAB®classes. The properties of ameta.EnumeratedValueobject correspond to the attributes of the enumeration member being described.

Allmeta.EnumeratedValueproperties are read-only. Query themeta.EnumeratedValueobject to obtain information about the enumeration member it describes.

Obtain ameta.EnumeratedValueobject from theEnumerationMemberListproperty of themeta.classobject.EnumerationMemberListis an array ofMeta.EnumeratedValueinstances, one per enumeration member.

Themeta.EnumeratedValueclass is a subclass of thehandleclass.

Example

To access themeta.EnumeratedValueobjects for a class, first create ameta.classobject for that class. For example, give the followingOnOffclass definition:

classdefOnOff < logicalenumerationOn (true) Off (false)endend

Obtain ameta.EnumeratedValueobject from theEnumerationMemberListproperty of themeta.classobject:

% Obtain the meta.class instance for the OnOff classmc = ?OnOff;% Get the array of EnumerateValue objectsenumList = mc.EnumerationMemberList;% Access the Name property of the first object in the arrayenumList(1).Name = ans = On

Properties

Property Purpose
Nameread-only Name of the enumeration member associated with thismeta.EnumeratedValueobject
Descriptionread-only

This property holds the first comment line following an enumeration name inside an enumeration block.

DetailedDescriptionread-only

This property holds the comment lines immediately following an enumeration definition up to the first line that does not begin with a comment. The lines are in a 1-by-n MATLABchararray with newline characters separating lines.

Methods

See thehandlesuperclass for inherited methods.

Events

See thehandlesuperclass for inherited events.

Was this topic helpful?