octave-bug-tracker
[Top][All Lists]
Advanced

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

Re: [Octave-bug-tracker] [bug #39789] Error while indexing certain cell


From: Alexander Mamonov
Subject: Re: [Octave-bug-tracker] [bug #39789] Error while indexing certain cell expressions
Date: Tue, 20 Aug 2013 09:31:46 +0400

Hello Rik,

Here is the behavior of Matlab R2008b:

>> c = cell(1,1,1)
c{1,1,1} = zeros(5, 2)
c{1,1,1}(:, 1) = 1

c =

    {[]}


c =

    [5x2 double]


c =

    [5x2 double]

>> c{1,1,1}

ans =

     1     0
     1     0
     1     0
     1     0
     1     0

>> size(c)

ans =

     1     1

Matlab doesn't have any problems with this code. So the bug may
probably be reclassified as Matlab incompatibility. Matlab's behavior
is good for consistency, since it allows for a unified treatment of
degenerate cases, like the 3-d cell array having only one element.
Thank you.

Regards,

Alex

On Tue, Aug 20, 2013 at 9:08 AM, Rik <address@hidden> wrote:
> Update of bug #39789 (project octave):
>
>                   Status:                    None => Confirmed
>
>     _______________________________________________________
>
> Follow-up Comment #1:
>
> Confirmed on a recent development tip (hg id bc924baa2c4e).  The issue is with
> how trailing dimensions are treated, and it would be useful to know how Matlab
> behaves for the same code input if you have access to it.
>
> The code
>
>
> c = cell (1,1,1);
>
>
> does not create a 1x1x1 cell array.  In Octave and Matlab trailing singleton
> dimensions are usually removed so this becomes
>
>
> c = cell (1,1);
>
>
> This can be checked with
>
>
> c = cell (1,1,1);
> size (c)
> ans =
>
>    1   1
>
>
> Your code sample works if the cell array is truly 3-dimensional.
>
>
> c = cell (1,1,2);
> c{1,1,1} = zeros (5,2);
> c{1,1,1}(:, 1) = 1;
>
>
>
>     _______________________________________________________
>
> Reply to this item at:
>
>   <http://savannah.gnu.org/bugs/?39789>
>
> _______________________________________________
>   Message sent via/by Savannah
>   http://savannah.gnu.org/
>



reply via email to

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