MATLAB:如何获取枚举类型所有成员的数组?

5
我想在MATLAB中获取枚举内所有项的数组值。有没有函数可以让我这样做?

1
你能发一下你所询问的内容的示例吗? - user616736
1个回答

6
假设您所说的是MATLAB枚举对象(而不是java.lang.Enumeration),您可以使用“enumeration”函数获取枚举成员列表。从MATLAB文档中,链接地址为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

同时您也可以在MathWorks网站观看出色的视频教程,链接为http://www.mathworks.com/videos/matlab/enumerations-in-r2010b.html


3
我想指出你应该使用 enumeration('EnumName') 而不是 enumeration(EnumName) - Alex Hirzel

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接