Mercurial > hg > octave-nkf
changeset 8937:f27b2c95817f
slightly simplify histc
author | Jaroslav Hajek <highegg@gmail.com> |
---|---|
date | Mon, 09 Mar 2009 16:03:17 +0100 |
parents | 42e24f4ebc8c |
children | 35e18344fae8 |
files | scripts/statistics/base/histc.m |
diffstat | 1 files changed, 4 insertions(+), 4 deletions(-) [+] |
line wrap: on
line diff
--- a/scripts/statistics/base/histc.m +++ b/scripts/statistics/base/histc.m @@ -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