source:
proiecte/pmake3d/make3d_original/Make3dSingleImageStanford_version0.1/third_party/lightspeed/int_hist.m
@
177
Last change on this file since 177 was 37, checked in by , 15 years ago | |
---|---|
File size: 318 bytes |
Rev | Line | |
---|---|---|
[37] | 1 | function 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 | |
6 | h = full(sum(sparse(1:length(x(:)),x(:),1))); | |
7 | if nargin == 2 | |
8 | if n > length(h) | |
9 | % pad with zeros | |
10 | h = [h zeros(1,n-length(h))]; | |
11 | end | |
12 | end |
Note: See TracBrowser
for help on using the repository browser.