Analyzing Timestamp array data

1 回表示 (過去 30 日間)
Hussam Ibrahim
Hussam Ibrahim 2017 年 12 月 4 日
回答済み: KSSV 2017 年 12 月 4 日
I have an array of 1x2 million timestamps, and I want to analyze this data by better viewing them. I want to have a slider (say every 0.001 seconds), and check how many stamps fall in each 0.001 second range.
e.g. dataArray = [0.0001 0.0005 0.0009 0.001 0.0012 0.0018] resultArray = [4 2] because first 4 elements are between 0 and 0.001, and last 2 are between 0.001 and 0.002. I am also trying to make this as fast as possible since I have million data points.
Best,

回答 (1 件)

KSSV
KSSV 2017 年 12 月 4 日
dataArray = [0.0001 0.0005 0.0009 0.001 0.0012 0.0018] ;
t0 = 0. ; t1 = 0.001 ;
dt = 0.001 ;
idx = cell(2,1) ;
for i = 1:2
idx{i} = find(dataArray > t0 & dataArray <= t1) ;
t0 = t0+dt ; t1 = t1+dt ;
end
iwant = cellfun(@nnz,idx) ;

カテゴリ

Help Center および File ExchangeMatrices and Arrays についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by