Drexel dragonThe Math ForumDonate to the Math Forum

Search All of the Math Forum:

Views expressed in these public forums are not endorsed by Drexel University or The Math Forum.

Math Forum » Discussions » Software » comp.soft-sys.matlab

Topic: find group of numbers are within a specified interval
Replies: 0  

Advanced Search

Back to Topic List Back to Topic List  

Posts: 338
Registered: 4/17/07
find group of numbers are within a specified interval
Posted: Sep 11, 2013 3:55 AM
  Click to see the message monospaced in plain text Plain Text   Click to reply to this topic Reply


% 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];
% maximum group number: n
% for every group
for ig=1:n
% find group members
for i=1:n
idx=A(i+1:end) < its_end_n
group(ig, ?????
% answer should be:
% group 1: 25 26 27 28
% group 2: 40 42

Any suggestion?

Point your RSS reader here for a feed of the latest messages in this topic.

[Privacy Policy] [Terms of Use]

© The Math Forum 1994-2015. All Rights Reserved.