[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
load and save in dynamically linked functions
From: |
John W. Eaton |
Subject: |
load and save in dynamically linked functions |
Date: |
Thu, 27 Nov 2003 13:43:10 -0600 |
On 27-Nov-2003, Thomas Weber <address@hidden> wrote:
| I have the following line of code in an .m file:
|
| load ([savename sprintf("%.6f",s) '.dat'], 'DE');
|
| where
| - savename = "data"
| - s = 1.2345678
Why not use
load (sprintf ("%s%.6f.dat DE", savename, s));
instead? Then, it seems to me that you could use
feval ("load", sprintf ("%s%.6f.dat DE", savename, s));
as an equivalent way to do the same thing (still in the scripting
language).
You should be able to do the same in a .oct file using the C++
interface for eval, but it might not do what you expect, since
load attempts to insert variables in the current symbol table. If
your .m file defines a function, the varibles would be loaded in the
local symbol table of the function, but when you translate it to a
.oct file, that function doesn't have its own symbol table. So where
do you want the new variables to appear?
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
-------------------------------------------------------------