enumeration - Class enumeration members and names - MATLAB (original) (raw)

Main Content

Class enumeration members and names

Syntax

Description

enumeration [ClassName](#d126e479257) displays the names of the enumeration members for the MATLAB® class with the name ClassName.

example

enumeration([obj](#d126e479283)) displays the names of the enumeration members for the class of obj.

example

[m](#d126e479304) = enumeration(___) returns the enumeration members in the column vector m.

example

[[m](#d126e479304),[s](#d126e479321)] = enumeration(___) returns the enumeration members in the column vector m and the member names in the cell array s. The names ins correspond element-wise to the enumeration members inm.

example

Examples

collapse all

Display the enumeration member names for the matlab.lang.OnOffSwitchState class.

enumeration matlab.lang.OnOffSwitchState

Enumeration members for class 'matlab.lang.OnOffSwitchState':

off
on

Display the enumeration member names for the matlab.lang.OnOffSwitchState class using an enumeration member object.

e = matlab.lang.OnOffSwitchState.off; enumeration(e)

Enumeration members for class 'matlab.lang.OnOffSwitchState':

off
on

Return the enumeration members for the matlab.lang.OnOffSwitchState class in a column vector.

m = enumeration('matlab.lang.OnOffSwitchState')

m = 2×1 OnOffSwitchState enumeration array

off
on 

Return the enumeration members of the matlab.lang.OnOffSwitchState class in a column vector and the enumeration names in a cell array.

[m,s] = enumeration('matlab.lang.OnOffSwitchState')

m = 2×1 OnOffSwitchState enumeration array

off
on 

s = 2×1 cell {'off'} {'on' }

Input Arguments

collapse all

Enumeration class name, specified as a character vector or string scalar.

Data Types: char | string

Instance of enumeration class.

Output Arguments

collapse all

Enumeration members, returned as a column vector.

Enumeration member names, returned as a cell array of character vectors.

More About

collapse all

Behavior of the enumeration function.

Extended Capabilities

Version History

Introduced in R2009b