# HG changeset patch # User Jaroslav Hajek # Date 1236610997 -3600 # Node ID f27b2c95817f53cdc837bfcd595d8585caa64f66 # Parent 42e24f4ebc8c70db07d0fcfd08d70b7a40e5519c slightly simplify histc diff -r 42e24f4ebc8c -r f27b2c95817f scripts/statistics/base/histc.m --- a/scripts/statistics/base/histc.m Sun Mar 08 16:40:10 2009 -0400 +++ b/scripts/statistics/base/histc.m Mon Mar 09 16:03:17 2009 +0100 @@ -77,10 +77,8 @@ error ("histc: second argument must be a vector"); endif - ## Allocate the histogram nsz = sz; nsz (dim) = num_edges; - n = zeros (nsz); ## the splitting point is 3 bins @@ -88,6 +86,9 @@ ## This is the O(M*N) algorithm. + ## Allocate the histogram + n = zeros (nsz); + ## Allocate 'idx' if (nargout > 1) idx = zeros (sz); @@ -147,8 +148,7 @@ iidx = iidx(idx != 0); ## Call accumarray to sum the indexed elements. - sz(dim) = length (edges); - n = accumarray (iidx(:), 1, sz); + n = accumarray (iidx(:), 1, nsz); endif