[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: how to access structure elements by a key
From: |
Paul Thomas |
Subject: |
Re: how to access structure elements by a key |
Date: |
Fri, 11 Feb 2005 16:32:01 +0100 |
a("a")
What you have tried is correct - it works fine on my working copies of
octave-2.1.50 and 2.1.64.
In octave-forge you will find getfield and setfield that do the same job, a
la Matlab. The .m version of both of these use the construct that you
tried.
Thus
a.("a") = 1.0;
a.("b") = 2.0;
a.("c") = 3.0;
disp (all ([a.("a") == a.a, a.("b") == a.b, a.("c") == a.c]))
Should display 1.
Paul T
-------------------------------------------------------------
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
-------------------------------------------------------------