help-octave
[Top][All Lists]
Advanced

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

Re: problem with 'for [val, key] = d'


From: Geraint Paul Bevan
Subject: Re: problem with 'for [val, key] = d'
Date: Fri, 12 Dec 2003 15:20:41 +0000
User-agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.5) Gecko/20031105 Thunderbird/0.3

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

T.Sariyski wrote these words on 12/12/03 15:13:
| Hi,
| Since I upgraded from 2.1.36 to 2.1.50 I have a strange problem. I
| generate a bunch of files with headers containing metainformation. To
| plot more than one curve on the same plot I generate a legend string
| from the header's data file, scale the data and use
| 'for [val, key] = d' with 'hold on' to plot:
|
| hold on
| for [val, key] = d
|   mplot(val.x,val.y,'-@');
| endfor
|
| The problem is the the legend labels doesn't correspond to the data set
| from where the label was extracted. It worked fine with 2.1.36 but
| 2.1.50 seems to use internal hashing because the order the keys are
| extracted is not always the order in which the keys are entered. Is
| there a way to control the order of the key?
|
| Thanks,
| Ted
|


You must have just been lucky with 2.1.36. From the manual section on
looping over structures (help -i looping):

~  "The elements are not accessed in any particular order.  If you need
to cycle through the list in a particular way, you will have to use the
function `struct_elements' and sort the list yourself."



- --
Geraint Bevan
http://www.mech.gla.ac.uk/~gbevan

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.2 (GNU/Linux)

iEYEARECAAYFAj/Z3MgACgkQcXV3N50QmNOlYwCfQhFNz2gqQkUak+eF7Dtt8/s0
srQAnA1M5WT5MPuakA21evTY1q5XkWfR
=xk+q
-----END PGP SIGNATURE-----



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