Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

MATLAB: How to get an array of all items of an enumeration?

Tags:

matlab

I would like to get the array value of all of the items inside an enumeration in MATLAB? Is there any function allow me to do that?

like image 807
Thang Nguyen Avatar asked Oct 17 '11 17:10

Thang Nguyen


1 Answers

Assuming that you're talking about a MATLAB Enumeration object (and not a java.lang.Enumeration), you can use the "enumeration" function to get a list of the enumeration members. From the MATLAB documentation, at http://www.mathworks.com/help/techdoc/ref/enumeration.html ,

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

See also the excellent video tutorial at the MathWorks web site, at http://www.mathworks.com/videos/matlab/enumerations-in-r2010b.html

like image 106
Bob Gilmore Avatar answered Sep 23 '22 21:09

Bob Gilmore