Daily average of 24 hours, for a year of data

3 visualizaciones (últimos 30 días)
Tushar Agarwal
Tushar Agarwal el 29 de Sept. de 2016
Respondida: Steven Lord el 29 de Sept. de 2016
Hi,
I have a data sheet of 8760 hours, and another col of 8769 electrical values - and I wanted to cummulate every 24 hours to find the daily avg, thus leaving me with only 365 rows.

Respuesta aceptada

Star Strider
Star Strider el 29 de Sept. de 2016
Use the reshape function.
If I understand correctly what your data are, this should do what you want:
hrs = [1:8760]'; % Create Column Vector
days = reshape(hrs, 365, []);
I assume the 8769 electrical values was an error, and you meant 8760. If that is correct, you can do the same with it as with the ‘hrs’ vector.

Más respuestas (1)

Steven Lord
Steven Lord el 29 de Sept. de 2016
If you're using release R2016b and have your data stored in a timetable, use the retime function on your timetable. See the "Aggregate Timetable Data and Calculate Mean Values" example on the retime documentation page for more information.

Categorías

Más información sobre Dates and Time en Help Center y File Exchange.

Etiquetas

Community Treasure Hunt

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

Start Hunting!

Translated by