source: proiecte/pmake3d/make3d_original/Make3dSingleImageStanford_version0.1/third_party/lightspeed/int_hist.m @ 37

Last change on this file since 37 was 37, checked in by (none), 14 years ago

Added original make3d

File size: 318 bytes
Line 
1function h = int_hist(x, n)
2% INT_HIST(x, n) is a histogram of all integer values 1..n in x.
3% If n is not given, max(x) is used.
4
5% Hans Olsson's one-liner from matlab faq
6h = full(sum(sparse(1:length(x(:)),x(:),1)));
7if nargin == 2
8  if n > length(h)
9    % pad with zeros
10    h = [h zeros(1,n-length(h))];
11  end
12end
Note: See TracBrowser for help on using the repository browser.