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: anonymous
Subject: [Octave-bug-tracker] [bug #60482] hist() misses error for non-numeric input
Date: Thu, 29 Apr 2021 17:02:31 -0400 (EDT)
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:88.0) Gecko/20100101 Firefox/88.0

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

                 Summary: hist() misses error for non-numeric input
                 Project: GNU Octave
            Submitted by: None
            Submitted on: Thu 29 Apr 2021 09:02:29 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
                 Release: 6.2.0
         Discussion Lock: Any
        Operating System: GNU/Linux

    _______________________________________________________

Details:

The hist() function gives an error for non-numeric data but not for
non-numeric bins. Either it should accept non-numeric bins and return the
correct frequency count, or it should give an error for non-numeric bins.


octave:31> data
data =
AABBBBBCCCCCCDDDDDDEFFFFFGGGHHHHHHHJJJJJJKKLLLLMMMMMMMMNNOOOPPPPPPPRRRSSSSSSSSTTUVVVWWWWWWWW

octave:32> u = unique(data)
u = ABCDEFGHJKLMNOPRSTUVW

octave:33> freq = hist (data, u)          # was trying to get a histogram of
letters
error: isfinite: argument must be numeric
error: called from
    hist at line 99 column 11

octave:34> freq = hist (data+0, u)        # this was accidental, but the
result is very surprising, hence this bug report
freq =

   13    7    8    7   12   10   10    3   10   12

octave:36> freq = hist (data+0, u+0)      # this was the correct command to
use and the correct result
freq =

   2   5   6   6   1   5   3   7   6   2   4   8   2   3   7   3   8   2   1  
3   8







    _______________________________________________________

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]