[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
RE: dynamic list of variable names
From: |
John W. Eaton |
Subject: |
RE: dynamic list of variable names |
Date: |
Fri, 16 Sep 2005 15:23:17 -0400 |
On 16-Sep-2005, Billings, Paul wrote:
| I don't know about being "stuck" -- a structure is quite natural:
| function ret = someother_function(Nvars)
| ...
| ret.variable_1 = 123;
| ret.variable_2 = 'abc';
| % etc.
|
| You might also look at the setfield function, which uses a string (perhaps
| generated via sprintf) to define the member names.
You can also use syntax like this
x.("foo") = value;
to set fields in a structure when the name is in a character string
(or variable containing a character string).
jwe
-------------------------------------------------------------
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
-------------------------------------------------------------