# Time intervals overlap detection and sum

5 views (last 30 days)
Alfredo Capobianchi on 17 Dec 2014
Hello, I have a table with three columns, named: Name, Start, End:
Name Start End
________________ _______________________ _______________________
'SD060025' '2016/09/24 08:48:11.9' '2016/09/24 08:56:29.9'
'CSK1_0550' '2016/09/24 09:07:23.6' '2016/09/24 09:13:41.6'
'SAO160924_0555' '2016/09/24 09:12:23.3' '2016/09/24 09:18:41.3'
Name is the name of the object, Start is the start time of the object, End is its stop time. Start and End define a continuous time interval for object in Name column. I have these times in MATLAB serial date number format.
I want to compute:
1. for each object, the cumulative time without overlapping
2. for each pair of objects, the cumulative overlapping time of the 2 objects
3. for each triplet of objects, the cumulative overlapping time of the 3 objects
4. for each set of 4 objects, the cumulative overlapping time of the 4 objects
5. and so on... until a set of 6 simultaneous objects
I've seen question Overlapping time-intervals WITHOUT for/while loops and it has helped me, but it is not enough because it does not process times.
Any idea?
Thank you very much
Alfredo
PS: I've found an alternative method which consist in analyzing the intervals one by one. For each interval, the elements of a vector of bins, each representing one minute, corresponding to the interval analyzed are incremented by one. This method is very simple and fast, but it has an error of up to 2 minutes per interval.