主要内容

枚举

集体枚举成员和名称

描述

例子

枚举班级名称显示MATLAB的枚举成员的名称®名字的课班级名称

例子

枚举(OBJ显示枚举成员的名称OBJ

例子

m=枚举(___返回列矢量中的枚举成员m

例子

[[m,,,,s] = enumeration(___返回列矢量中的枚举成员m和单元格数组中的成员名称s。名称中的s与枚举成员的相应元素m

例子

全部收缩

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

枚举matlab.lang.onoffswitchstate
“ matlab.lang.onoffswitchstate”类的枚举成员:关闭

使用枚举成员对象显示MATLAB.LANG.ONOFFSWITCHSTATE类的枚举成员名称。

e = matlab.lang.onoffswitchstate.off;枚举(E)
“ matlab.lang.onoffswitchstate”类的枚举成员:关闭

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

M =枚举('matlab.lang.onoffswitchstate'
M = 2x1 Onoffswitchstate枚举阵列打开

返回列中的Matlab.lang.onoffswitchstate类中的枚举成员和单元格数组中的枚举名称。

[m,s] =枚举('matlab.lang.onoffswitchstate'
M = 2x1 Onoffswitchstate枚举阵列打开
s=2x1单元{'off'} {'on'}

输入参数

全部收缩

枚举类名称,指定为字符向量或字符串标量。

数据类型:char|细绳

枚举类的实例。

输出参数

全部收缩

枚举成员,作为列向量返回。

枚举成员名称,作为字符向量的单元格数组返回。

更多关于

全部收缩

行为描述

Behavior of the枚举功能。

  • 来自内置类的枚举类可以为给定的枚举成员指定多个名称。

  • 当您致电枚举函数没有输出参数,MATLAB显示器only the first name for each enumeration member (as specified in the class definition). To see all available enumeration members and their names, use the two output arguments. For example,[M,S] =枚举(OBJ);

扩展功能

C/C ++代码生成
使用MATLAB®CODER™生成C和C ++代码。

版本历史记录

在R2009b中引入

也可以看看