Skip to Main Content Skip to Search
Product Documentation

enumeration - Display class enumeration member and names

Syntax

enumeration ClassName
enumeration(obj)
m = enumeration(ClassName)
m = enumeration(obj)
[m,s] = enumeration(ClassName)
[m,s] = enumeration(obj)

Description

enumeration ClassName displays the names of the enumeration members for the MATLAB class with the name ClassName.

enumeration(obj) displays the names of the enumeration members for the class of obj.

m = enumeration(ClassName) returns the enumeration members for the class in the column vector m of objects.

m = enumeration(obj) returns the enumeration members for the class of object, obj, in the column vector m of objects.

[m,s] = enumeration(ClassName) returns the names of the enumeration members in the cell array of strings s. The names in s correspond element-wise to the enumeration members in m.

[m,s] = enumeration(obj) returns the enumeration members for the class of object, obj, in the column vector m of objects.

Tips

Input Arguments

ClassName

The name of the enumeration class, in single quotes.

obj

A instance of an enumeration class.

Output Arguments

m

Column vector of enumeration members.

s

Cell array of strings containing the enumeration names.

Examples

All examples use the following enumeration class.

classdef Boolean < logical
   enumeration
      No  (0)
      Yes (1)
      Off (0)
      On  (1)
   end
end
 

Display the names of the enumeration members for class Boolean:

enumeration Boolean
Enumerations for class Boolean:

    No
    Yes
 

Get the enumeration members for class Boolean in a column vector of objects:

members = enumeration('Boolean')
members = 

    No 
    Yes
 

Get all available enumeration members and their names:

[members, names] = enumeration('Boolean')
members = 

    No 
    Yes
    No 
    Yes


names = 

    'No'
    'Yes'
    'off'
    'on'

See Also

Tutorials

  


Free MATLAB Interactive Kit

Explore how to use MATLAB to make advancements in engineering and science.


Download free kit

Trials Available

Try the latest version of MATLAB and other MathWorks products.


Get trial software
 © 1984-2012- The MathWorks, Inc.    -   Site Help   -   Patents   -   Trademarks   -   Privacy Policy   -   Preventing Piracy   -   RSS