help-octave
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: cs-lists, structure arrays ....


From: Stefan van der Walt
Subject: Re: cs-lists, structure arrays ....
Date: Tue, 5 Apr 2005 12:40:47 +0200
User-agent: Mutt/1.5.6+20040907i

On Tue, Apr 05, 2005 at 01:12:13PM +0300, Shai Ayal wrote:
> Hi all,
> 
> I'm getting a bit lost in the list/cell/structure constructs. My data is 
> most naturally adapted to be in a array of structures:
> 
> data(1).name="Shai"
> data(1).height=189
> data(1).weight="undisclosed"
> 
> data(2).name="....
> 
> now, how do I extract the heights of everyone ?

octave:79> y
y =
{
  height =

  (,
    [1] = 1.8800
    [2] = 1.8900
  ,)

  name =

  (,
    [1] = Stefan
    [2] = Shai
  ,)

}

octave:80> h = {y.height}
ans =

{
  [1,1] = 1.8800
  [1,2] = 1.8900
}

octave:92> [h{:}]
ans =

  1.8800  1.8900


Regards
Stefan



-------------------------------------------------------------
Octave is freely available under the terms of the GNU GPL.

Octave's home on the web:  http://www.octave.org
How to fund new projects:  http://www.octave.org/funding.html
Subscription information:  http://www.octave.org/archive.html
-------------------------------------------------------------



reply via email to

[Prev in Thread] Current Thread [Next in Thread]