qcount.m 455 B

12345678910111213141516171819
  1. function y=qcount(x, start, finish)
  2. % y=between(x, start, finish)
  3. % works for sorted 1D vectors.
  4. % using find you get o(n) , by assuming that the vector is sorted you get
  5. % 2*o(log(n)). which is WAY better.
  6. if numel(start)~=numel(finish)
  7. y=[]; return;
  8. end
  9. y=zeros(size(start));
  10. if numel(start)>1
  11. for sx=1:numel(start)
  12. y(sx)=numel(stats.qbetween(x,start(sx), finish(sx)));
  13. end
  14. else
  15. y=numel(stats.qbetween(x,start,finish));
  16. end