Daily average of 24 hours, for a year of data

3 次查看(过去 30 天)
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.

采纳的回答

Star Strider
Star Strider 2016-9-29
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.

更多回答(1 个)

Steven Lord
Steven Lord 2016-9-29
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.

类别

Help CenterFile Exchange 中查找有关 MATLAB 的更多信息

标签

Community Treasure Hunt

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

Start Hunting!

Translated by