[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: .oct: load matrix from file
From: |
Paul Kienzle |
Subject: |
Re: .oct: load matrix from file |
Date: |
Sun, 22 Oct 2000 06:25:40 +0100 |
User-agent: |
Mutt/1.2.5i |
You can call load easily enough from an .oct function:
octave_value_list args;
args(0) = filename;
args(1) = "P1";
feval("load", args, 0); // no arguments returned
if ( error_state )
// unable to load variable
You can access the current symbol table easily enough as well,
though I don't know if this is the approved approach:
octave_value P1;
symbol_record *sr = curr_sym_tab->lookup("P1");
if (sr == NULL || sr->def().is_undefined ())
// unable to access variable (maybe global?)
else
P1 = sr->def ();
It is a shame you have to go through the symbol table all the time with
load. It would be nice if it could return a structure of all the names
in the file instead.
Paul Kienzle
address@hidden
On Fri, Oct 20, 2000 at 04:01:37PM +0200, Andy Jacobson wrote:
> Howdy,
>
> I am a rank beginner at the .oct game, and I am having a
> difficult time seeing the forest through the trees.
>
> There is an operation I want to make on a sequence of n
> matrices, P1, P2, ....Pn, all stored in a single .mat file. I
> would like to access these matrices from an .oct function, but
> I can't quite grok the philosophy behind the source. I had
> hoped that the octave_value_list returned by an feval of
> "load" would give the set of matrices in the file, but this is
> not so; the returned list is empty (and the matrices are loaded
> into the interpreter environment).
>
> I have pored over the source but can find no hint of a .cc
> file doing such a thing. Anybody have a pointer to
> enlightening examples?
>
> Peace,
> Andy
>
> --
> address@hidden
>
>
>
> -----------------------------------------------------------------------
> Octave is freely available under the terms of the GNU GPL.
>
> Octave's home on the web: http://www.che.wisc.edu/octave/octave.html
> How to fund new projects: http://www.che.wisc.edu/octave/funding.html
> Subscription information: http://www.che.wisc.edu/octave/archive.html
> -----------------------------------------------------------------------
>
>
-----------------------------------------------------------------------
Octave is freely available under the terms of the GNU GPL.
Octave's home on the web: http://www.che.wisc.edu/octave/octave.html
How to fund new projects: http://www.che.wisc.edu/octave/funding.html
Subscription information: http://www.che.wisc.edu/octave/archive.html
-----------------------------------------------------------------------