octave-maintainers
[Top][All Lists]
Advanced

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

Subtle nested structure assignment behavior


From: Daniel J Sebald
Subject: Subtle nested structure assignment behavior
Date: Wed, 24 Dec 2008 01:15:51 -0600
User-agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.7.3) Gecko/20041020

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


Sometimes I'm seeing this error:

error: scalar cannot be indexed with .
error: evaluating assignment expression near line 9, column 23


However, there is a work-around in the following way:

octave:17> one.two.three = 68;
octave:18> sroot(2).one = one
sroot =
{
 one =

 (,
   [1] =
   {
     two =
     {
       three: 1x1 scalar
     }

   }

   [2] =
   {
     two =
     {
       three: 1x1 scalar
     }

   }

 ,)

}


Dan


reply via email to

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