enum in octave?
Matthias Brennwald
matthias.brennwald at nagra.ch
Mon Oct 13 02:28:13 CDT 2008
On Mon, 2008-10-13 at 01:53 -0500, help-octave-request at cae.wisc.edu
wrote:
> Message: 2
> Date: Fri, 10 Oct 2008 11:49:03 -0700 (PDT)
> From: Jim H <James.Haefner at usu.edu>
> Subject: enum in octave?
> To: help-octave at octave.org
> Message-ID: <19923940.post at talk.nabble.com>
> Content-Type: text/plain; charset=us-ascii
>
>
> Hi,
> I think the question I want to ask is "does Octave have the concept of
> enum
> as in C?"
>
> My application: I would like to pass a set of arguments to a function
> in an
> array (p[ ]), but I want to refer to the elements of the array by
> mnemonic
> names like:
>
> y[BOB] = p[R]*y[BOB]*(1 - y[BOB]/p[K]);
>
> in C this could be done with #define R 0 #define K 1, etc. or by an
> enum
> structure.
>
> Possible in octave?
>
> Jim
Jim
How about this (in Octave):
---------------
R = 0;
K = 1;
BOB = ...; (insert whatever value needs to go here)
y[BOB] = p[R]*y[BOB]*(1 - y[BOB]/p[K]);
---------------
Cheers
Matthias
More information about the Help-octave
mailing list