[major] struct array indexing in tip
Jaroslav Hajek
highegg at gmail.com
Tue Jan 20 15:02:04 CST 2009
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.
cheers
--
RNDr. Jaroslav Hajek
computing expert
Aeronautical Research and Test Institute (VZLU)
Prague, Czech Republic
url: www.highegg.matfyz.cz
More information about the Bug-octave
mailing list