0001 function count=cumHistCount(x, edges, plotOpt)
0002
0003
0004
0005 if nargin<1; selfdemo; return; end
0006 if nargin<3, plotOpt=0; end
0007
0008 edges2=[-inf; edges(:)];
0009 count=histc(x, edges2);
0010 count=cumsum(count);
0011 count=count(1:end-1);
0012
0013 if plotOpt
0014 plot(edges, count, 'o-');
0015 xlabel('X smaller than');
0016 ylabel('Counts');
0017 end
0018
0019
0020 function selfdemo
0021 x=rand(1000, 1);
0022 edges=0.1:0.1:1;
0023 plotOpt=1;
0024 count=cumHistCount(x, edges, plotOpt);