您如何在枚举值数组中表示缺失值?
对于其他数据类型,我们可以使用NaN或缺少。使用此示例枚举类:
classdef MyEnum
enumeration
A
B
end
end
我尝试过:
>> [ MyEnum.A MyEnum.B missing ]
Error using horzcat
The following error occurred converting from missing to MyEnum:
Unsupported conversion from 'missing' to enumeration 'MyEnum'.
>> [ MyEnum.A MyEnum.B NaN ]
Error using horzcat
The following error occurred converting from double to MyEnum:
Cannot call the constructor of 'MyEnum' outside of its enumeration block.
似乎我在这里缺少一些非常基本的东西……请帮助!
答案 0 :(得分:0)
两种方法: