Count frequency of number in set time period

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!

Réponses (1)

Matt Fig
Matt Fig le 31 Mai 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)

Catégories

En savoir plus sur Control System Toolbox dans Centre d'aide et File Exchange

Tags

Question posée :

le 31 Mai 2011

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by