How do I calculate the mean value for the days in a big data set?

2 ビュー (過去 30 日間)
Johan Wilson
Johan Wilson 2017 年 5 月 4 日
編集済み: Johan Wilson 2017 年 5 月 4 日
Hi I have a big data set 46933x12 and the data is collected every 5 minuets and the dates looks like
2014-01-01 00:00:00
2014-01-01 00:05:00
2014-01-01 00:10:00
... I want to have mean values for each of the 11 columes. How do i do this?
  6 件のコメント
Andrei Bobrov
Andrei Bobrov 2017 年 5 月 4 日
編集済み: Andrei Bobrov 2017 年 5 月 4 日
Please attach small example of your data file.
Johan Wilson
Johan Wilson 2017 年 5 月 4 日
Here is a small sample of 60 data points.

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

採用された回答

KL
KL 2017 年 5 月 4 日
Here is a sample code with 3 variables and 5 days with uniform 5 minute timestep
a = rand(288*5,3);
t = (1:288:288*6)';
amean = zeros(5,3);
for i=1:length(t)-1
amean(i,:) = mean(a(t(i):t(i+1)-1,:));
end

その他の回答 (2 件)

Andrei Bobrov
Andrei Bobrov 2017 年 5 月 4 日
編集済み: Andrei Bobrov 2017 年 5 月 4 日
T = table2timetable(readtable('Test.Dataset.xls','ReadVariableNames',false));
out = retime(T,'daily','mean');
or for MATLAB <= R2016a
T = readtable('Test.Dataset.xls','ReadVariableNames',false);
[a,b,c] = datevec(T.Var1);
[dv,~,t] = unique([a,b,c],'rows');
[x,y] = ndgrid(t,1:size(T,2)-1);
out1 = [dv,accumarray([x(:),y(:)],reshape(T{:,2:end},[],1),[],@mean)];
  1 件のコメント
Johan Wilson
Johan Wilson 2017 年 5 月 4 日
編集済み: Johan Wilson 2017 年 5 月 4 日
I downloaded mathlab 2017 had 2015 before. It looks like it works for the small sample but it dont work for the full set. This is a slightly bigger one.

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


Baptiste Ranguetat
Baptiste Ranguetat 2017 年 5 月 4 日
meanData = zeros(1,11);
for i=1:11
meanData(i) = mean(data(:,i));
end

カテゴリ

Help Center および File ExchangeData Import from MATLAB についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by