How do I find the time between when the animal_speed exceeded the threshold till when it dipped below the threshold (all instances when this happened)?
Show older comments
The data set I am working with has 17 columns and over 10000 rows. Two particular columns are 'time' and 'animal_speed'. I am also using a Threshold of 0.10m/s.
To find all instances when the 'animal_speed' exceeds the Threshold, I use this:
>> [row, col, v] = find(data_set.animal_speed > 0.10);
which gives me all 'animal_speed' row numbers where the values are greater than 0.10.
Plotting the graph with 'time' and 'animal speed' and including the Threshold line (y=0.10) is not a problem.

However, how do I find the time between when the animal speed exceeded the threshold till when the speed dipped below the threshold (all instances when this happened)?
Thanks!
Accepted Answer
More Answers (1)
dpb
on 9 Jun 2015
That's certainly an erratic animal!!! :)
Anyway, this is the same question rephrased in slightly different terms just yesterday--
NB: the correction of using ";" for the concatenation operation since your data are also column-oriented. You simply need to turn your speed data into the 0-1 as the switch position the other poster already had; that's simply
speedFlag=speed>=threshold;
where speed is your data set column of interest and threshold the value. Choose '>' or '>=' at your preference of inclusive or no...
Categories
Find more on Graphics Object Properties 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!