Thread Subject: Enumeration

Subject: Enumeration

From: Miguel Moura

Date: 24 Apr, 2009 12:41:01

Message: 1 of 4

Hello,

I am using Matlab's OOP.
Can I create Enumerations or something similar as in C#?
I am using Matlab 2009a.

Thanks,
Miguel

Subject: Enumeration

From: Peter Perkins

Date: 24 Apr, 2009 13:50:34

Message: 2 of 4

Miguel Moura wrote:


> Can I create Enumerations or something similar as in C#?
> I am using Matlab 2009a.

Miguel, if you have access to the Statistics Toolbox, you may find nominal and ordinal arrays helpful, depending on what you want to do. If you're looking for a better way to store discrete data than using coded integers, or using cell arrays of strings, they may be what you want. If you're looking for a way to create named constants, perhaps this is what you're looking for:

<http://www.mathworks.com/access/helpdesk/help/techdoc/index.html?/access/helpdesk/help/techdoc/matlab_oop/bru76zw-1.html>

Subject: Enumeration

From: David Comboni

Date: 9 Feb, 2010 10:30:05

Message: 3 of 4

Hi,
Peter Perkins wrote in message:
>
> Miguel, if you have access to the Statistics Toolbox, you may find nominal and ordinal arrays helpful, depending on what you want to do. If you're looking for a better way to store discrete data than using coded integers, or using cell arrays of strings, they may be what you want. If you're looking for a way to create named constants, perhaps this is what you're looking for:
>
> <http://www.mathworks.com/access/helpdesk/help/techdoc/index.html?/access/helpdesk/help/techdoc/matlab_oop/bru76zw-1.html>
>
Hi,
> Miguel, if you have access to the Statistics Toolbox, you may find nominal and ordinal arrays helpful, depending on what you want to do. If you're looking for a better way to store discrete data than using coded integers, or using cell arrays of strings, they may be what you want. If you're looking for a way to create named constants, perhaps this is what you're looking for:
>
> <http://www.mathworks.com/access/helpdesk/help/techdoc/index.html?/access/helpdesk/help/techdoc/matlab_oop/bru76zw-1.html>

Searching for an answer to enumeration I bumped out with this thread. So I would like to add a question to this one. Matlab has an option to define enumeration instanciating it with Simulink:

classdef(Enumeration) PrimaryColors < Simulink.IntEnumType
    enumeration
        Red(1),
        Blue(4),
        Yellow(8)
    end
end

Does this work when you are programming in Matlab and want to use this class?

Thanks,
David

Subject: Enumeration

From: Robert

Date: 12 Aug, 2010 07:57:21

Message: 4 of 4

"David Comboni" <david_comboni@go.com> wrote in message <hkrdfd$huk$1@fred.mathworks.com>...
> Hi,
> Peter Perkins wrote in message:
> >
> > Miguel, if you have access to the Statistics Toolbox, you may find nominal and ordinal arrays helpful, depending on what you want to do. If you're looking for a better way to store discrete data than using coded integers, or using cell arrays of strings, they may be what you want. If you're looking for a way to create named constants, perhaps this is what you're looking for:
> >
> > <http://www.mathworks.com/access/helpdesk/help/techdoc/index.html?/access/helpdesk/help/techdoc/matlab_oop/bru76zw-1.html>
> >
> Hi,
> > Miguel, if you have access to the Statistics Toolbox, you may find nominal and ordinal arrays helpful, depending on what you want to do. If you're looking for a better way to store discrete data than using coded integers, or using cell arrays of strings, they may be what you want. If you're looking for a way to create named constants, perhaps this is what you're looking for:
> >
> > <http://www.mathworks.com/access/helpdesk/help/techdoc/index.html?/access/helpdesk/help/techdoc/matlab_oop/bru76zw-1.html>
>
> Searching for an answer to enumeration I bumped out with this thread. So I would like to add a question to this one. Matlab has an option to define enumeration instanciating it with Simulink:
>
> classdef(Enumeration) PrimaryColors < Simulink.IntEnumType
> enumeration
> Red(1),
> Blue(4),
> Yellow(8)
> end
> end
>
> Does this work when you are programming in Matlab and want to use this class?
>
> Thanks,
> David

without simulink derive your enum from an integer data type:

classdef(Enumeration) ENUMTriplets < int32
    enumeration
        Huey (0)
        Dewey (1)
        Louie (2)
    end
end


Cheers,

     Robert

Tags for this Thread

Everyone's Tags:

Add a New Tag:

Separated by commas
Ex.: root locus, bode

What are tags?

A tag is like a keyword or category label associated with each thread. Tags make it easier for you to find threads of interest.

Anyone can tag a thread. Tags are public and visible to everyone.

Tag Activity for This Thread
Tag Applied By Date/Time
enumeration David Comboni 9 Feb, 2010 05:34:05
rssFeed for this Thread

Contact us at files@mathworks.com