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!

回答 (1 件)

Matt Fig
Matt Fig 2011 年 5 月 31 日

0 投票

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)

カテゴリ

ヘルプ センター および File ExchangeControl System Toolbox についてさらに検索

タグ

質問済み:

2011 年 5 月 31 日

Community Treasure Hunt

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

Start Hunting!

Translated by