Count frequency of number in set time period
Show older comments
I have what I hope is a relatively simple problem. I have a variable that records coded responses, and a time variable which records when these responses occurred. I would like to find out the frequencies of particular numbers during a specified time period. For instance, how many 1's are recorded during 6sec - 30secs.
Is there a function I can run that operates like counts if number = 1 and time is >6 and <30?
Thanks for any help!
Answers (1)
Matt Fig
on 31 May 2011
responses = round(rand(1,10)*2) % An example data set
times = 1:10; % Example time set...
% Count responses equal to 1 in a certain time range.
counts = sum(responses(times>3 & times<9)==1)
Categories
Find more on Control System 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!