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

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

[Octave-bug-tracker] [bug #60482] hist() misses error for non-numeric in


From: Nicholas Jankowski
Subject: [Octave-bug-tracker] [bug #60482] hist() misses error for non-numeric input
Date: Fri, 30 Apr 2021 12:47:18 -0400 (EDT)
User-agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/90.0.4430.93 Safari/537.36

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

looking at hist, it allows a char input for bins because the input checker
assumes that if the second input is class(char), it must be an option or
property.  Hence, when hist isn't told how many bins to use, it just uses 10.


note that the output is the same as if no bin option had been speficied:


>> freq = hist (data + 0, u)
freq =

   13    7    8    7   12   10   10    3   10   12

>> freq = hist (data + 0)
freq =

   13    7    8    7   12   10   10    3   10   12


Now, why it doesn't throw an error on an unrecognized option is something else
to peek at.  matlab's hist does not accept character options/properties as
inputs, so can easily throw an error for any non-numeric for 2nd input or
later. Octave appears to accept a large number of properties, so it's not
quite that simple.  

probably easiest bugfix is to have it recognize the invalid option/parameter
string and throw an error. 

    _______________________________________________________

Reply to this item at:

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

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




reply via email to

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