FUNCTION REFERENCE
enumeration
Members of an enumeration class.
Members of an enumeration class.
Syntax
enumeration('Name'); enumeration(obj); [m, names] = enumeration('Name')An enumeration block lists the members, each optionally with constructor arguments:
classdef Color
properties
R, G, B
end
methods
function c = Color(r, g, b), c.R = r; c.G = g; c.B = b; end
end
enumeration
Red (1, 0, 0)
Blue (0, 0, 1)
end
endColor.Red is the member: its properties read as usual, char(c) is 'Red', and c == Color.Red or c == 'Red' compare members. Without an output enumeration lists the member names; m holds the members and names their names as a column cell.
Example
iskeyword('enumeration') % falseDifferences from MATLAB: Object arrays are not supported yet, so m is a column cell of members rather than an array. Enumeration classes derived from numeric types (classdef C < int32) and handle enumeration classes are not supported yet.
These are the engine’s help pages. Each page keeps its compatibility notes. File operations are unavailable in the browser.