[major] struct array indexing in tip
John W. Eaton
jwe at octave.org
Tue Jan 20 16:06:36 CST 2009
On 20-Jan-2009, Jaroslav Hajek wrote:
| On Mon, Jan 19, 2009 at 3:45 AM, Nicholas Tung <ntung at ntung.com> wrote:
| > in revision
| > hg tip
| > changeset: 8534:0eb83938c8bc
| >
| > struct indexing is messed up. The following code should simply add to the
| > value of c at 2, but creates some weird cell array...
| > octave:1> a.c = [1, 2, 3]
| > a =
| > {
| > c =
| > 1 2 3
| > }
| > octave:2> e = [a, a]
| > e =
| > {
| > 1x2 struct array containing the fields:
| > c
| > }
| > octave:3> e(1).c(2)
| > ans = 2
| > octave:4> e(1).c(2) += 1
| > e =
| > {
| > 1x2 struct array containing the fields:
| > c
| > }
| > octave:5> e.c
| > ans =
| > {
| > [1,1] =
| > 1 2 3
| > [1,2] = 3
| > }
| > ans =
| > 1 2 3
| >
| > Thanks in advance; please tell me when it's fixed.
| >
| > cheers,
| > Nicholas
|
| Gosh, it took me about a day and half, and here goes:
| http://hg.savannah.gnu.org/hgweb/octave/rev/3d8a914c580e
|
| Your bug seems fixed. Moreover, for instance, the following will now work:
|
| [a(1:2).x] = deal (1, 3)
| [a(:).x(2)] = deal (5, 6)
|
| I'm still not convinced all cases are caught, so I encourage everyone
| to experiment.
| In fact, I'd be surprised if it were really bug-free, but make check
| didn't catch anything.
Thanks for looking at this problem.
Maybe someone (other than Jaroslav) would like to generate some tests
so these problems don't resurface later?
jwe
More information about the Bug-octave
mailing list