How do I create enumerated types in MATLAB?

前端 未结 10 2165
不知归路
不知归路 2020-12-02 17:04

Are there enumerated types in MATLAB? If not, what are the alternatives?

10条回答
  •  半阙折子戏
    2020-12-02 17:34

    There is actually a keyword in MATLAB R2009b called 'enumeration'. It seems to be undocumented, and I cannot say I know how to use it, but the functionality is probably there.

    You can find it in matlabroot\toolbox\distcomp\examples\+examples

    classdef(Enumeration) DmatFileMode < int32
    
        enumeration
            ReadMode(0)
            ReadCompatibilityMode(1)
            WriteMode(2)
        end
    
    end
    

提交回复
热议问题