[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Structure problem
From: |
Ben Sapp |
Subject: |
Structure problem |
Date: |
Tue, 06 Jan 2004 10:15:42 -0700 |
Hi,
I am using octave 2.1.52 on Windows and something that worked in 2.1.50 is
failing now. I wrote an oct file that loads Ortec's chn file format into
a structure in octave. (Chn files hold gamma ray spectrum.) I create an
Octave_map called map and then set many elements like this: (C++ code)
map["seconds"] = octave_value(str.append(chead.seconds, 2));
I do this many times for all elements in the C structure chead. I then
create an octave_value that I return like this "retval =
octave_value(map);" A loadchn followed by a whos reveals the following:
octave:78> Ra = loadchn(fName);
octave:79> whos Ra
*** local user variables:
prot type rows cols name
==== ==== ==== ==== ====
rwd struct 0 0 Ra
Notice the 0, 0 for rows and cols where as if I create a structure on the
octave command line it has 1,1. Afterwards, I want to be able to add an
element called fName to the structure Ra but this fails as follows:
octave:80> Ra.fName = fName
error: invalid structure assignment
error: assignment to structure element failed
error: assignment failed, or no method for `struct = string'
error: evaluating assignment expression near line 80, column 10
Do you have any idea why this is failing? What is the correct way to
create a structure in an oct file?
Thanks,
Ben.
P.S. If I create a structure on the command line I can successfully
perform the fName assignment mentioned above.
Ben Sapp Los Alamos National Laboratory
email: <mailto:address@hidden> Phone: (505)667-8004
Fax: (505)665-3657
-------------------------------------------------------------
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
-------------------------------------------------------------
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- Structure problem,
Ben Sapp <=