필터 지우기
필터 지우기

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