Subtle nested structure assignment behavior

John W. Eaton jwe at octave.org
Wed Dec 24 09:56:35 CST 2008


On 24-Dec-2008, Daniel J Sebald wrote:

| Octave doesn't allow assigning a value to a structure array element
| if the levels get too deep.  Is this a bug?  For example:
| 
| octave:11> sroot(1).one.two.three = 55
| sroot =
| {
|   one =
|   {
|     two =
|     {
|       three: 1x1 scalar
|     }
| 
|   }
| 
| }
| 
| octave:12> sroot(2).one.two.three = 66
| error: invalid vector index = 2
| error: evaluating assignment expression near line 12, column 24

Using a copy of Octave built from the current sources, I see

  octave:1>   x(1).a.b.c = 1;
  octave:2>   x(2).a.b.c = 2;
  error: matrix cannot be indexed with .

which also does not look right, but is not the same error as you
show.  So what version of Octave are you using?

jwe


More information about the Octave-maintainers mailing list