Analyzing Timestamp array data

2 次查看(过去 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 CenterFile Exchange 中查找有关 Develop Apps Using App Designer 的更多信息

标签

Community Treasure Hunt

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

Start Hunting!

Translated by