arrays - MATLAB collecting time data -


i have following data, 'd'

0.0012 0.0043 0.0034 0.0108 0.0042 0.0052 0.0516 0.0034 0.0023 .... , on 

i know time data ranges 0-0.1. best way group un-ordered data time ranges. want collect values in range 0<=d<0.002, 0.002<=d<0.004 , on in 0.002 blocks until reach 0.1.

you can use accumarray:

step = .002; limit = .1; result = accumarray(1+floor(d(:)/step), d(:), [1+floor(limit/step), 1], @(x) {x}); 

in example, gives

>> result{1} ans =     0.0012 >> result{2} ans =     0.0034     0.0034     0.0023 

etc.


Comments

Popular posts from this blog

html - Outlook 2010 Anchor (url/address/link) -

javascript - Why does running this loop 9 times take 100x longer than running it 8 times? -

Getting gateway time-out Rails app with Nginx + Puma running on Digital Ocean -