How to get the average duration for consecutive states
Show older comments
I wanted to know if there is a way to get the average duration of a state. Attached is a .mat data file with 3 different states indicated with 1, 2 and 3. I am trying to find out the average duration for each of these, if the column is the time(1000 sec) then what's the average duration for each of them, or how many consecutive states are there for specified amount of seconds: 1s in 1sec,1s in 2 sec, 1s in 4 sec,.. 1s in 256 sec,..etc. So if there was a consecutive 1,1,1,1 then that would be one round added to the 4 seconds.
I assumed I need to use histogram bin counts but I don't know how to write the code myself. Or just finding out how many times times it switches from state 1 to state 3.
Accepted Answer
More Answers (0)
Categories
Find more on Database Toolbox 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!