Mercurial > hg > octave-avbm
changeset 14613:e7c8e31f8e5d
hist.m: Add test to check for correct NaN normalising
author | Jordi Gutiérrez Hermoso <jordigh@octave.org> |
---|---|
date | Wed, 09 May 2012 18:44:58 -0400 |
parents | 545580e7ebfa |
children | 4e9dc46d4125 |
files | scripts/plot/hist.m |
diffstat | 1 files changed, 5 insertions(+), 1 deletions(-) [+] |
line wrap: on
line diff
--- a/scripts/plot/hist.m +++ b/scripts/plot/hist.m @@ -149,7 +149,7 @@ if (nargin > 2 && ! ischar (varargin{iarg})) ## Normalise the histogram. norm = varargin{iarg++}; - freq = freq / sum(! isnan (y)) * norm; + freq = freq / sum(! isnan (y)) * norm; endif if (nargout > 0) @@ -182,6 +182,10 @@ %! assert (xx, [1,2,3]); %! assert (nn, [3,2,1]); %!test +%! [nn,xx] = hist ([1 1 1 NaN NaN NaN 2 2 3],[1 2 3], 6); +%! assert (xx, [1,2,3]); +%! assert (nn, [3,2,1]); +%!test %! [nn,xx] = hist ([[1:4]', [1:4]'], 3); %! assert (xx, [1.5;2.5;3.5]); %! assert (nn, [[2,1,1]',[2,1,1]']);