help-octave
[Top][All Lists]
Advanced

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

cs-lists, structure arrays ....


From: Shai Ayal
Subject: cs-lists, structure arrays ....
Date: Tue, 05 Apr 2005 13:12:13 +0300
User-agent: Mozilla Thunderbird 1.0 (X11/20041206)

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 ?

data(:).height gives me a "cs-list" type which is no-where documented and I can't seem to convert it to a vector (or in fact to anything). The only way I found is using a for loop on the structure array

hh=zeros(1,length(data));
for i=1:length(data), hh(i)=data(i).height; endfor

but this is not very "comfortable".

Also, if you have any suggestions on better data-structures to hold this kind of data feel free

Shai




-------------------------------------------------------------
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]