help-octave
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

eval and struct


From: John W. Eaton
Subject: eval and struct
Date: Fri, 22 Nov 2002 11:03:10 -0600

On 22-Nov-2002, Iago Mosqueira <address@hidden> wrote:

| I am assigning columns of a matrix (y) to elements in a structure (mat),
| reading the names from a cell of strings (names), as in
| 
| for el=1:ncols
| 
|     eval(['mat.' names(el,:) '=y(:,' num2str(el) ');']);
| 
| endif
| 
| Everything goes fine until the last element, when I get this error
| (LnPosterior is the name stored in the last field of the cell):
| 
| error: structure has no member 'LnPosterior'
| 
| but all previous assigments, 9 if that matters, worked fine. If I issue in
| the debug command line mat.LnPosterior=y(:,10), then it works, but not
| through eval.
| 
| Any ideas what might be happening? Many thanks,

Can you please send a *complete* example that demonstrates your
problem?  If I have to make guesses about what additional data might
be required to reproduce the bug, I will probably waste time by
guessing incorrectly.

Also, it might help to include other information that normally goes in
a bug report.  The simplest way to do that is use the bug_report
function from Octave, or the octave-bug script from a shell prompt.

Thanks,

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
-------------------------------------------------------------



reply via email to

[Prev in Thread] Current Thread [Next in Thread]