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

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

[Octave-bug-tracker] [bug #57383] cell2mat does not warn on mixed class


From: A.R. Burgers
Subject: [Octave-bug-tracker] [bug #57383] cell2mat does not warn on mixed class numeric input
Date: Sun, 8 Dec 2019 13:31:38 -0500 (EST)
User-agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/64.0.3282.140 Safari/537.36 Edge/18.17763

URL:
  <https://savannah.gnu.org/bugs/?57383>

                 Summary: cell2mat does not warn on mixed class numeric input
                 Project: GNU Octave
            Submitted by: arb
            Submitted on: Sun 08 Dec 2019 06:31:37 PM UTC
                Category: Octave Function
                Severity: 3 - Normal
                Priority: 5 - Normal
              Item Group: Missed Error or Warning
                  Status: None
             Assigned to: None
         Originator Name: 
        Originator Email: 
             Open/Closed: Open
         Discussion Lock: Any
                 Release: 5.1.0
        Operating System: Any

    _______________________________________________________

Details:

with this script


ver = version
mixed = {pi, single(2.0)};
class_cat = class([pi, single(2.0)])
a = cell2mat(mixed);
class_cell2mat = class(a)


Octave outputs:


ver = 5.1.1
class_cat = single
class_cell2mat = single


matlab outputs:


ver = '9.5.0.1049112 (R2018b) Update 3'
class_cat = 'single'

Error using cell2mat (line 45)
All contents of the input cell array must be of the same data type.

Error in tst (line 4)
a = cell2mat(mixed);


Both matlab and octave concatenate single/double matrices, with a single
result.

Octave's cell2mat is written in terms of cat, returns a single result, matlab
errors.

I guess octave doesn't need to produce an error in this case, but a warning on
mixed class input would be nice.




    _______________________________________________________

Reply to this item at:

  <https://savannah.gnu.org/bugs/?57383>

_______________________________________________
  Message sent via Savannah
  https://savannah.gnu.org/




reply via email to

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