[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: eval and struct
From: |
Iago Mosqueira |
Subject: |
Re: eval and struct |
Date: |
Fri, 22 Nov 2002 18:40:49 -0000 |
OK, Sorry if it was too cryptic. The problem came from using the split
function on a string obtained by fgets. It had a \n at the end of the last
line, which broke the eval call.
Cheers,
iago
----- Original Message -----
From: "John W. Eaton" <address@hidden>
To: "Iago Mosqueira" <address@hidden>
Cc: "octave-help" <address@hidden>
Sent: 22 November 2002 17:03
Subject: eval and struct
> 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
-------------------------------------------------------------