Find beginning and end of a series of events
4 views (last 30 days)
Show older comments
Hi I have a log file that captures events with a timestamp. When no event occurs nothing is logged, meaning there is no continuous time stamp data. My goal is to identify when each "usage session" starts and ends based on some criterion: e.g. no event occurred for x hours. Is there an easy way to identify start/end through matlab?
Example data set (1st col: timestamp, 2nd/3rd: event)
[ 59.2945] '00070051' 'Down'
[ 59.4056] '00070051' 'Down'
[ 59.6964] '00070051' 'Down'
[ 59.8762] '00070051' 'Down'
[ 59.9439] '00070051' 'Down'
[ 60.0577] '00070051' 'Down'
[ 61.0465] '00070051' 'Down'
[ 61.1140] '00070051' 'Down'
[ 61.2269] '00070051' 'Down'
[ 61.3165] '00070051' 'Down'
[ 61.4064] '00070051' 'Down'
[ 61.5191] '00070051' 'Down'
[ 61.6088] '00070051' 'Down'
[ 61.7668] '00070051' 'Down'
[ 61.8563] '00070051' 'Down'
[ 61.9915] '00070051' 'Down'
[ 62.1038] '00070051' 'Down'
[ 62.2181] '00070051' 'Down'
[ 62.3292] '00070051' 'Down'
[ 62.4416] '00070051' 'Down'
[ 62.5540] '00070051' 'Down'
[ 62.6663] '00070051' 'Down'
[ 62.7564] '00070051' 'Down'
[ 62.8914] '00070051' 'Down'
[ 135.5951] '000c0223' 'Home'
[ 135.7017] '000c0223' 'Home'
[ 142.2507] '0007004f' 'Right'
[ 142.3606] '0007004f' 'Right'
[ 142.4056] '0007004f' 'Right'
[ 142.5180] '0007004f' 'Right'
[ 142.5855] '0007004f' 'Right'
[ 142.6978] '0007004f' 'Right'
[ 142.7430] '0007004f' 'Right'
[ 142.8557] '0007004f' 'Right'
[ 142.9018] '0007004f' 'Right'
[ 143.0128] '0007004f' 'Right'
[ 143.1928] '00070058' 'Select'
[ 143.3054] '00070058' 'Select'
[ 144.4978] '00070051' 'Down'
[ 144.5890] '00070051' 'Down'
[ 144.7921] '0007004f' 'Right'
[ 144.9256] '0007004f' 'Right'
[ 144.9704] '0007004f' 'Right'
[ 145.1065] '0007004f' 'Right'
0 Comments
Accepted Answer
Benjamin Kraus
on 28 Dec 2017
My first thought is to use diff on the timestamps (to get the time between events) and then threshold the results (anything over a certain time is the start of a new session).
How long are the gaps between each session relative to the inner-event interval within a session?
More Answers (0)
See Also
Categories
Find more on Time Series Events in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!