how to average the minutes data to hourly data if the data is missing for some minutes(samples) in between

hi everyone,
I am having data every two minutes time interval with the format
9/10/2013 4:00 721.19141 4.999999523 0 35.29541 -300 -0.011333227
9/10/2013 4:02 721.67969 4.999999523 0 35.43457 -300 0.561000109 ....
Now i would like to average the data to each hour and save.
Now the problem is there are some data missing. how to overcome this problem??
date and time are in same column, the remaining data are in different columns.
please see attached file

 採用された回答

n = xlsread('Book1.xlsx');
n(:,1) = n(:,1) + datenum('30.12.1899','dd.mm.yyyy');
[Y,M,D,H] = datevec (n(:,1));
[c0,~,c1] = unique([Y,M,D,H],'rows');
[ii,jj] = ndgrid(c1,1:size(n,2)-1);
mm = accumarray([ii(:),jj(:)],reshape(n(:,2:end),[],1),[],@mean);
out = [c0, mm];

4 件のコメント

reddy
reddy 2015 年 6 月 3 日
for second line matlab says Undefined function 'plus' for input arguments of type 'cell'.
reddy
reddy 2015 年 6 月 3 日
i think there is no need of second line in the code...
Ingrid
Ingrid 2015 年 6 月 3 日
yes there is, it is because matlab and excel use a different date as starting point to calculate the datenumber
reddy
reddy 2015 年 6 月 16 日
thank you so much guys...
especially thanks to Andrei Bobrov

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

その他の回答 (1 件)

Ingrid
Ingrid 2015 年 6 月 3 日
first read in the excel data in matlab then use datenum on the first column to get the date in matlab use histc and accumarray to get the average data per hour

カテゴリ

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

質問済み:

2015 年 6 月 3 日

コメント済み:

2015 年 6 月 16 日

Community Treasure Hunt

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

Start Hunting!

Translated by