I have defined an Enumerated class which inherits the int32 class as described in the Code Generation documentation.
classdef(Enumeration) MyEnum < int32 enumeration OK(1), Error(2), Warning(3), endend
The MATLAB file I am generating code from has the following two statements:
x = MyEnum(2);x = MyEnum(MyEnum.Error);
Code generation is successful with the first line, but not with the second. I am receiving the following error:
??? Expression must be numeric. Found it to be MyEnum.
Both lines, however, have the same effect when running them in MATLAB. Why can't code be generated from the second line?
Best Answer