How to convert irregular daily data to annual data?
2 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
Keegan Carvalho
el 19 de Ag. de 2022
Comentada: Keegan Carvalho
el 19 de Ag. de 2022
Hi All!
I have a dataset (excel file attached - pcr.xlsx) of daily data values. The values are expressed as "Tonnes". I wanted to convert these to annual data from 1959 till date. My issue is that the daily data are irregular i.e. each year does not contain 365/366 values, so I am confused on how to directly get the answer (if each year had constant number of data points - 365, I think it would be easier).
I did try the "convert2annual" function but had no luck with it. I would appreciate some help in this regard. Thank you!
0 comentarios
Respuesta aceptada
Chunru
el 19 de Ag. de 2022
Editada: Chunru
el 19 de Ag. de 2022
T = readtable("https://www.mathworks.com/matlabcentral/answers/uploaded_files/1101770/pcr.xlsx");
T(T.Tonnes == 0, :) =[]; % remove rows where Tonnes == 0
head(T)
T1 = timetable(datetime(T.Dates, "InputFormat", 'dd-MM-yyyy'), T.Tonnes);
T1.Properties.VariableNames = "Tonnes";
T2 = retime(T1, 'yearly', 'mean')
3 comentarios
Más respuestas (0)
Ver también
Categorías
Más información sobre Data Type Conversion 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!