Managing large files - irregular data points

Hi Folks,
I have a data set where the data points are measured at irregular intervals, sometimes 10 measurements per minute, other times more/less. I want to average the values within each minute so I end up with one value per minute. Each data point has a datevec value, e.g. [ 2013 7 25 10 41] which corresponds to 10:41 am on the 25th July. How can I tell Matlab to average all the data points within each minute?
Thanks

3 件のコメント

the cyclist
the cyclist 2013 年 7 月 30 日
編集済み: the cyclist 2013 年 7 月 30 日
How is your time info stored, and how are your measurements stored? All together in the same array? Two different arrays? Please give a bit more detail, or better yet a small example of the variables.
Cedric
Cedric 2013 年 7 月 30 日
Also, do you have minutes with no data point?
Dirk
Dirk 2013 年 7 月 30 日
The data is currently in two separate arrays taken from the same excel spreadsheet, one with the time and the other with the data. Every time point has a corresponding data point. There is a data point for every minute. Thanks

サインインしてコメントする。

 採用された回答

the cyclist
the cyclist 2013 年 7 月 30 日
編集済み: the cyclist 2013 年 7 月 30 日

0 投票

Here is how you can do it, if your time data and your measurement data are in two separate arrays:
t = [ 2013 7 25 10 41;
2013 7 25 10 41;
2013 7 25 10 41;
2013 7 25 10 42;
2013 7 25 10 42;
2013 7 25 10 43]
m = [1;2;3;4;5;6];
[unique_t,i,j] = unique(t,'rows')
mean_m = accumarray(j,m,[],@mean)
It should be pretty easy for you to adapt this to your case, if that's not what you have

その他の回答 (0 件)

カテゴリ

ヘルプ センター および File Exchange で Dates and Time についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by