[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: |
Sergei Steshenko |
Subject: |
Re: difference of cell arrays behavior between octave-3.0.5 and octave-3.4.2 |
Date: |
Mon, 1 Aug 2011 09:07:36 -0700 (PDT) |
--- On Mon, 8/1/11, Ben Abbott <address@hidden> wrote:
> From: Ben Abbott <address@hidden>
> Subject: Re: difference of cell arrays behavior between octave-3.0.5 and
> octave-3.4.2
> To: "Sergei Steshenko" <address@hidden>
> Cc: address@hidden
> Date: Monday, August 1, 2011, 5:07 AM
>
> 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
>
>
>
So, do I understand correctly - your screen session is from Matlab and
it doesn't accept
foo{2}(:) = [2;3]
like I experienced ?
...
I have rechecked again myself. with no old packages in 3.4.2 I also have
"
address@hidden:~> (export GNUTERM=wxt;
/mnt/sdb8/sergei/AFSWD_debug/20110601/octave-3.4.2/binsh/octave)
GNU Octave, version 3.4.2
Copyright (C) 2011 John W. Eaton and others.
This is free software; see the source code for copying conditions.
There is ABSOLUTELY NO WARRANTY; not even for MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. For details, type `warranty'.
Octave was configured for "i686-pc-linux-gnu".
Additional information about Octave is available at http://www.octave.org.
Please contribute if you find this software useful.
For more information, visit http://www.octave.org/help-wanted.html
Read http://www.octave.org/bugs.html to learn how to submit bug reports.
For information about changes from previous versions, type `news'.
octave:1> 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>
".
So, a practical question - how do I achieve what I want ? Isn't cell array
supposed to hold values of possibly different sizes per index ?
Thanks,
Sergei.