I have an hourly meteorological data screenshot attached which i need to convert to average daily data. Since I have a long period of data it is difficult to do it in excel. If anyone knows how to code it in matlab pls let me know

2 次查看(过去 30 天)

采纳的回答

Andrei Bobrov
Andrei Bobrov 2018-2-21
编辑:Andrei Bobrov 2018-2-21
T = readtable('your_xls_file.xls');
t = datetime(strcat(T{:,2},'_',T{:,1}),'i','MM/dd/uuuu_HH:mm');
TT = table2timetable(T(:,3:end),'RowTimes',t);
E = regexp(TT{:,end},'\d+','match');
E = str2double(cat(1,E{:}));
tt = duration(E(:,1),E(:,2),0);
TT = [TT(:,1:end-1),table(tt,'v',TT.Properties.VariableNames(end))];
TTout = retime(TT,'daily','mean');
TTout = TTout(all(~isnan(TTout{:,:}),2),:);
or
T = readtable('your_xls_file.xls');
t = datetime(T{:,2});
A = regexp(T{:,end},'\d+','match');
A = str2double(cat(1,A{:}));
tt = duration(A(:,1),A(:,2),0);
TT = table2timetable([T(:,3:end-1),table(tt,'v',T.Properties.VariableNames(end))],'RowTimes',t);
TTout = varfun(@mean,TT,'GroupingVariables','Time');

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Power and Energy Systems 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by