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: Mon, 9 Dec 2019 03:21:11 -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

Follow-up Comment #2, bug #57383 (project octave):

In your final example matlab gives:


>> cell2mat({pi, int8(1)})
Error using cell2mat (line 45)
All contents of the input cell array must be of the same data type.


matlab and octave agree on the rules of concatenation, and addition of mixed
numeric classes, no problem there, 1+single(2) and 1+int8(2) give the same
result in matlab as octave.

However cell2mat in matlab has more stringent rules, and does not allow mixed
classes.

My point is that code with cell2mat involving mixed class numeric input runs
under octave, for good reasons, but throws an error in matlab, and a warning
in octave could alert the user to that possible error.

    _______________________________________________________

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]