[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Octave-bug-tracker] [bug #39041] concatenation of cell array and scalar
From: |
Mike Miller |
Subject: |
[Octave-bug-tracker] [bug #39041] concatenation of cell array and scalar struct |
Date: |
Mon, 22 May 2017 14:51:03 -0400 (EDT) |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Firefox/52.0 |
Follow-up Comment #14, bug #39041 (project octave):
>From the maintainers list, in Matlab 2017a:
>> [cell(1), struct('foo','bar')]
ans =
1×2 cell array
[] [1×1 struct]
>> [struct('foo','bar'), cell(1)]
Error using horzcat
The following error occurred converting from cell to struct:
Conversion to struct from cell is not possible.
>> [{}, struct()]
ans =
cell
[1×1 struct]
>> [struct(), {}]
ans =
struct with no fields.
That last one makes me sad. This means that if the first element is a struct
and the remaining elements are empty cell arrays, they can be ignored, and the
result is a scalar struct. But if any elements are non-empty cell arrays, then
the error is thrown.
If the leading element is a cell array, empty or not, then the result is a
cell array containing the scalar struct or struct array as a single cell
element.
_______________________________________________________
Reply to this item at:
<http://savannah.gnu.org/bugs/?39041>
_______________________________________________
Message sent via/by Savannah
http://savannah.gnu.org/
- [Octave-bug-tracker] [bug #39041] concatenation of cell array and scalar struct, Rik, 2017/05/22
- [Octave-bug-tracker] [bug #39041] concatenation of cell array and scalar struct, Rik, 2017/05/22
- [Octave-bug-tracker] [bug #39041] concatenation of cell array and scalar struct, Mike Miller, 2017/05/22
- [Octave-bug-tracker] [bug #39041] concatenation of cell array and scalar struct, Mike Miller, 2017/05/22
- [Octave-bug-tracker] [bug #39041] concatenation of cell array and scalar struct, Mike Miller, 2017/05/22
- [Octave-bug-tracker] [bug #39041] concatenation of cell array and scalar struct, Mike Miller, 2017/05/22
- [Octave-bug-tracker] [bug #39041] concatenation of cell array and scalar struct, Mike Miller, 2017/05/22
- [Octave-bug-tracker] [bug #39041] concatenation of cell array and scalar struct, Mike Miller, 2017/05/22
- [Octave-bug-tracker] [bug #39041] concatenation of cell array and scalar struct, Rik, 2017/05/22
- [Octave-bug-tracker] [bug #39041] concatenation of cell array and scalar struct, Mike Miller, 2017/05/22
- [Octave-bug-tracker] [bug #39041] concatenation of cell array and scalar struct,
Mike Miller <=
- [Octave-bug-tracker] [bug #39041] concatenation of cell array and scalar struct, Rik, 2017/05/22
- [Octave-bug-tracker] [bug #39041] concatenation of cell array and scalar struct, Mike Miller, 2017/05/22
- [Octave-bug-tracker] [bug #39041] concatenation of cell array and scalar struct, Mike Miller, 2017/05/22