bugGNU Octave - Bugs: bug #43113, Vertically concatenating elements...

 
 

bug #43113: Vertically concatenating elements of cell with empty cs-list gives error

Submitter:  Philipp Kutin <pkutin>
Submitted:  Sun 31 Aug 2014 12:40:59 PM UTC
   
 
Category:  Interpreter Severity:  3 - Normal
Priority:  5 - Normal Item Group:  Matlab Compatibility
Status:  Fixed Assigned to:  None
Originator Name:  Open/Closed:  * Closed
Release:  * dev Operating System:  * GNU/Linux
Fixed Release:  None Planned Release:  None
* Mandatory Fields

Add a New Comment Rich Markup
   

Jump to the original submission

Wed 31 Dec 2014 07:21:59 PM UTC, comment #6: 

Fixed on the development branch in this changeset (http://hg.savannah.gnu.org/hgweb/octave/rev/e5a78897be9e).  Closing report.

Rik <rik5>
Group administrator
Tue 30 Dec 2014 12:07:42 AM UTC, comment #5: 

Matlab says:

>> x = {''}


x =

     {''}

Michael Godfrey <godfrey>
Group Member
Mon 29 Dec 2014 10:57:33 PM UTC, comment #4: 

Another Matlab test:


x = {''}


Does this produce an empty cell or a 1x1 cell with an empty entry?

Rik <rik5>
Group administrator
Mon 29 Dec 2014 07:52:48 PM UTC, comment #3: 

Oh boy, Matlab compatibility.  Can I get a few more examples run?  Maybe easiest to invoke 'diary on' before executing all these and then just upload the file rather than trying to use verbatim notation.


{1, 2 ; ; 3, 4}
{1, 2 ; [] ; 3, 4}
{1, 2 ; [] [] ; 3, 4}
{1, 2 ; [] [] []; 3, 4}
{1, 2 ; [] [] 5; 3, 4}
{1, 2 ; [] 5 [] 6; 3, 4}
{1, 2 ; [] 5 [] 6 7; 3, 4}
{1, 2 ; {}; 3, 4}
{1, 2 ; {} {}; 3, 4}
{1, 2 ; {} {} {}; 3, 4}
{1, 2 ; {} {} 5; 3, 4}


Rik <rik5>
Group administrator
Mon 29 Dec 2014 05:09:11 PM UTC, comment #2: 

MY Matlab R2009b says:

>>z = cell(5,4,3,0,2);
>>{1,2,3; z{:}; 4,5,6 }


ans +

   []]    [2]    [3]
   [4]    [5]    [6]

>>

Michael Godfrey <godfrey>
Group Member
Mon 29 Dec 2014 04:41:04 PM UTC, comment #1: 

Confirmed.  I think the general summary rule is that Matlab will allow the concatenation of any empty value because it simply removes it.

Could you try a slight variation of your original test where the empty cs-list is in the middle of the construction?


z = cell(5,4,3,0,2);
{1,2,3; z{:}; 4,5,6 }



Rik <rik5>
Group administrator
Sun 31 Aug 2014 12:40:59 PM UTC, original submission:  

In MATLAB, the following is valid:


>> z = cell(5,4,3,0,2);
>> {1,2,3; 4,5,6; z{:}}
ans =
    [1]    [2]    [3]
    [4]    [5]    [6]


As you can see, the cell array whose elements are unpacked doesn't even have to have a size consistent with the target cell, such as 0-by-3 in the above example. This makes sense, as that information presumably isn't present in a cs-list any more.

In contrast, here's the current Octave behavior:

octave:1> z = cell(0,3);
octave:2> {1,2,3; 4,5,6; z{:}}
error: number of columns must match


Philipp Kutin <pkutin>

 

(Note: upload size limit is set to 16384 kB, after insertion of the required escape characters.)

Attach Files:
   
   
Comment:
   

No files currently attached

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -email is unavailable- added by godfrey (Posted a comment)
  • -email is unavailable- added by rik5 (Posted a comment)
  • -email is unavailable- added by pkutin (Submitted the item)
  •  

    There are 0 votes so far. Votes easily highlight which items people would like to see resolved in priority, independently of the priority of the item set by tracker managers.

    Only group members can vote.

     

    Follow 4 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2014-12-31 rik5 StatusConfirmed Fixed
        Open/ClosedOpen Closed
    2014-12-29 rik5 StatusNone Confirmed
        SummaryVerticaly concatenating elements of cell with empty cs-list gives error Vertically concatenating elements of cell with empty cs-list gives error

    Back to the top

    Powered by Savane 3.13-4448.
    Corresponding source code