Borrar filtros
Borrar filtros

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 visualizaciones (últimos 30 días)

Respuesta aceptada

Andrei Bobrov
Andrei Bobrov el 21 de Feb. de 2018
Editada: Andrei Bobrov el 21 de Feb. de 2018
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');

Más respuestas (0)

Categorías

Más información sobre Power and Energy Systems en Help Center y File Exchange.

Community Treasure Hunt

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

Start Hunting!

Translated by