help-octave
[Top][All Lists]
Advanced

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

Re: difference of cell arrays behavior between octave-3.0.5 and octave-3


From: Ben Abbott
Subject: Re: difference of cell arrays behavior between octave-3.0.5 and octave-3.4.2
Date: Mon, 01 Aug 2011 08:07:56 -0400

On Aug 1, 2011, at 5:31 AM, Sergei Steshenko wrote:

> In octave-3.0.5 I have:
> 
> "
> octave:1> foo{1}(:) = []
> foo =
> 
> {
>  [1,1] = [](0x0)
> }
> 
> octave:2> foo{2}(:) = [2;3]
> foo =
> 
> {
>  [1,1] = [](0x0)
>  [1,2] =
> 
>     2   3
> 
> }
> 
> octave:3> 
> ".
> 
> In octave-3.4.2 I have:
> 
> "
> foo{1}(:) = []
> foo =
> {
>  [1,1] = [](0x0)
> }
> octave:2> foo{2}(:) = [2;3]
> error: A(I) = X: X must have the same size as I
> octave:2>
> ".
> 
> 
> Why is it so that in octave-3.4.2 I have an error ?
> 
> Why at all size checking kicks in - "foo{2}(:)" doesn't yet have size,
> it should be created according to RHS.
> 
> Which of the two behaviors is nominally correct (Matlab) ?

>> clear all
>> foo{1}(:) = []

foo = 

    {[]}

>> foo{2}(:) = [2;3]
???  In an assignment  A(:) = B, the number of elements in A and B
must be the same.

>> foo{2}(1:2) = [2;3]

foo = 

    []    [1x2 double]

I compared with the developers sources (default branch) and see that his last 
command works there as well.

Ben




reply via email to

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