Average time spent in a region
5 views (last 30 days)
Show older comments
I am trying to calculate the percentage of time spent by an object in a specified region over a given period of time. I have a file tracking the coordinates of the object in the only axis that I care about(let's say the x axis). The file is just a vector with each point corresponding to where the object is in the frame of the recording. I imagine that I can create a counter that starts at zero and while I'm looking at the, let's say, 2700th to 5400th coordinate point, if x is greater than a specified amount, 1 is added to the counter. Then I could take the total number of counts and divide it by the total number of x coordinate points to calculate the percentage of time spent in that region. Thanks so much for all your help!
1 Comment
Walter Roberson
on 29 Jan 2014
Are the points equally-spaced in time? Or should the object be assumed to stay at a point until it suddenly "jumps" to the next point? Are the points only x, or are they x and y?
Answers (0)
See Also
Categories
Find more on Clocks and Timers 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!