bugGNU Octave - Bugs: bug #48585, hist output does not correspond to...

 
 

bug #48585: hist output does not correspond to Matlab

Submitter:  Sebastian <sschoeps>
Submitted:  Thu 21 Jul 2016 05:00:09 PM UTC
   
 
Category:  Octave Function Severity:  3 - Normal
Priority:  5 - Normal Item Group:  WTF, Matlab?!?
Status:  Wont Fix Assigned to:  None
Originator Name:  Sebastian Open/Closed:  * Closed
Release:  * dev Operating System:  * Any
Fixed Release:  None Planned Release:  None
* Mandatory Fields

Add a New Comment Rich Markup
   

Sun 09 Jun 2019 12:40:05 AM UTC, comment #4: 

See bug #56465 which covers the output class of the second output of hist.

Rik <rik5>
Group administrator
Sun 09 Jun 2019 12:26:03 AM UTC, comment #3: 

This looks like Matlab just being stupid.  Testing with R2019A, the following produces no error


[nn,xx] = hist (1:8, [1 5 3 7])


But this does,


[nn, xx] = hist (1:8, [1 7 3 5])
Error using histc
Edge vector must be monotonically non-decreasing


I'm marking this bug as Won't Fix.  I'll file a different bug report about the return value of xx being single when it should be double.

Rik <rik5>
Group administrator
Mon 25 Jul 2016 06:53:13 AM UTC, comment #2: 

MATLAB seems to consider the current behavior not as a bug. It is consistent since 2011a. Example:

[nn,xx] = hist ([1:8], [1 5 3 7]);
assert (xx, [1 5 3 7]);
assert (nn, [3 1 1 3]);

Around 2014b the "single" bug was fixed: "[nn, xx] = hist (y, single (3));" now returns xx as double. uint8 does not work at all in Matlab.

I attach the MATLAB test script that I have used with all version since 2011.



(file #38017)

Sebastian <sschoeps>
Fri 22 Jul 2016 04:46:44 PM UTC, comment #1: 

Do we really want to skip the sort if it produces strange (and I assume) incorrect results?

I'm wondering whether the output dimensions consistent between Matlab versions.  Maybe we were compatible at one time?

John W. Eaton <jwe>
Group administrator
Thu 21 Jul 2016 05:00:09 PM UTC, original submission:  

Matlab has some strange ideas about "hist.m", e.g.
- the dimension of the return vectors is not well documented (and it's rather inconsistent)
- Matlab does not sort for you if your vector of bins is unsorted (and thus the results maybe unexpected)

I fixed Octave the Octave file to be more like Matlab, see the attached files.

Sebastian

Sebastian <sschoeps>

 

(Note: upload size limit is set to 16384 kB, after insertion of the required escape characters.)

Attach Files:
   
   
Comment:
   

Attached Files
file #38017:  hist_test.m added by sschoeps (3KiB - application/octet-stream)
file #37975:  hist_new.m added by sschoeps (8KiB - application/octet-stream)
file #37976:  hist_patch.m added by sschoeps (3KiB - application/octet-stream)

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -email is unavailable- added by rik5 (Posted a comment)
  • -email is unavailable- added by jwe (Updated the item)
  • -email is unavailable- added by sschoeps (Submitted the item)
  •  

    There are 0 votes so far. Votes easily highlight which items people would like to see resolved in priority, independently of the priority of the item set by tracker managers.

    Only group members can vote.

     

    Follow 7 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2019-06-09 rik5 Item GroupMatlab Compatibility WTF, Matlab?!?
        StatusPatch Submitted Wont Fix
        Open/ClosedOpen Closed
    2016-07-25 sschoeps Attached File- Added hist_test.m, #38017
    2016-07-22 jwe StatusNone Patch Submitted
    2016-07-21 sschoeps Attached File- Added hist_new.m, #37975
        Attached File- Added hist_patch.m, #37976

    Back to the top

    Powered by Savane 3.13-f8d8.
    Corresponding source code