From: Miguel Moura on
Hello,

Is it possible to use enumeration in Matlab?

In C# an enumeration is as follows:
enum Colors {
Yellow,
Red,
Blue
};

If not, is there an alternative?

This is really useful and since I am using OOP and exporting Matlab code to C#.

Thank You,
Miguel
From: us on
"Miguel Moura" <mdNOSPAMmoura(a)gmREMOVEail.com> wrote in message <i1s3n2$1p2$1(a)fred.mathworks.com>...
> Hello,
>
> Is it possible to use enumeration in Matlab?
>
> In C# an enumeration is as follows:
> enum Colors {
> Yellow,
> Red,
> Blue
> };
>
> If not, is there an alternative?
>
> This is really useful and since I am using OOP and exporting Matlab code to C#.
>
> Thank You,
> Miguel

a hint:
- for a workaround...

help struct;

us
From: Robert on
"Miguel Moura" <mdNOSPAMmoura(a)gmREMOVEail.com> wrote in message <i1s3n2$1p2$1(a)fred.mathworks.com>...
> Hello,
>
> Is it possible to use enumeration in Matlab?
>
> In C# an enumeration is as follows:
> enum Colors {
> Yellow,
> Red,
> Blue
> };
>
> If not, is there an alternative?
>
> This is really useful and since I am using OOP and exporting Matlab code to C#.
>
> Thank You,
> Miguel

You can use a class definition for that. Search classdef(Enumeration) in the Matlab Help for the syntx description. It is placed in the "Embedded Matlab" section, but it works fine without any additional matlab toolbox (only simulink) in my installation.

Chears,

Robert