How to calculate daily mean from hourly data
10 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
Michael Omodara
el 20 de Jul. de 2020
Respondida: Steven Lord
el 22 de Oct. de 2022
I have hourly temperature data (without date and time) about 5200. I want to extract daily mean and store the output as a vector using a for loop. Can anyone give me useful suggestion?
Respuesta aceptada
Star Strider
el 20 de Jul. de 2020
One approach:
T = 1:5200; % Temperature Vector
for k = 1:24:numel(T)
k2 = ceil(k/24);
idx = k:(min(k+23,numel(T)));
DailyMean(k2) = mean(T(idx));
end
There may be more efficient ways to do this, depending on what your temperature data actuallly are.
2 comentarios
Jeffrey Eiyike
el 22 de Oct. de 2022
thats the link to the question. I am new here. Thank you so much
Más respuestas (1)
Steven Lord
el 22 de Oct. de 2022
If you have your data stored in a timetable array I recommend using the retime function to change the time basis of your data from hourly to daily.
0 comentarios
Ver también
Categorías
Más información sobre Loops and Conditional Statements 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!