Daily average of 24 hours, for a year of data

2 views (last 30 days)
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.

Accepted Answer

Star Strider
Star Strider on 29 Sep 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.

More Answers (1)

Steven Lord
Steven Lord on 29 Sep 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.

Categories

Find more on Descriptive Statistics in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!