Search All of the Math Forum:
Views expressed in these public forums are not endorsed by
NCTM or The Math Forum.


Mike
Posts:
338
Registered:
4/17/07


find group of numbers are within a specified interval
Posted:
Sep 11, 2013 3:55 AM


Hi
% Given some sorted date/time numbers, I'd like to find group of % date/time numbers % are within a specified interval, for example, 5 days. % % First, I convert date strings to date numbers. % Given that these numbers are for example:
% sorted numbers A=[1 25 26 27 28 40 42 50]; n=length(A); interval=5; % maximum group number: n % for every group for ig=1:n % find group members for i=1:n start_n=A(i); its_end_n=start_n+interval1; idx=A(i+1:end) < its_end_n group(ig, ????? end end % answer should be: % group 1: 25 26 27 28 % group 2: 40 42
Any suggestion?



