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

## [Octave-bug-tracker] [bug #53199] hist returns different results dependi

 From: jsh Subject: [Octave-bug-tracker] [bug #53199] hist returns different results depending on 2nd 1:n/n input argument Date: Wed, 21 Feb 2018 01:17:02 -0500 (EST) User-agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:58.0) Gecko/20100101 Firefox/58.0

```URL:
<http://savannah.gnu.org/bugs/?53199>

Summary: hist returns different results depending on 2nd
1:n/n input argument
Project: GNU Octave
Submitted by: jsh
Submitted on: Wed 21 Feb 2018 06:17:00 AM UTC
Category: Octave Function
Severity: 3 - Normal
Priority: 5 - Normal
Item Group: Matlab Compatibility
Status: None
Assigned to: None
Originator Name:
Originator Email:
Open/Closed: Open
Discussion Lock: Any
Release: 4.2.1
Operating System: Any

_______________________________________________________

Details:

In this case below hist returns different results depending if the second
argument is 'n' or '1:n' where n is the number of count boxes. Specifically,
if only the 'n' argument is supplied then the a=15 count is missing.

a = [  1,  2,  3,  4, 0;
5,  4,  6,  7, 8;
9, 12, 11, 10, 0;
13, 16, 15, 14, 0;
17, 20, 19, 18, 0;
21, 22, 23,  2, 0;
24, 27, 26, 25, 0;
28, 31, 30, 29, 0;
32, 35, 34, 33, 0;
36, 39, 38, 37, 0;
40, 43, 42, 41, 0;
44, 47, 46, 45, 0;
48, 51, 50, 49, 0;
52, 55, 54, 53, 0];

n = max(a(:));
cnt1 = hist( a(:), 1:n )
cnt2 = hist( a(:),   n )
cnt1 - cnt2
assert( isequal(cnt1,cnt2) )

_______________________________________________________

<http://savannah.gnu.org/bugs/?53199>

_______________________________________________
Message sent via/by Savannah
http://savannah.gnu.org/

```