# daily averages of hourly data

6 views (last 30 days)
aggelos on 4 Nov 2012
Commented: Felipe on 12 Apr 2017
how can I compute daily averages of hourly data in a column vector; the data have the following form and i have a total of 52584 observations.
1 4,36188440018071 2 4,24430502188277 3 4,21243736283539 4 4,21243736283539 5 4,16143877425792 6 4,16143877425792 7 4,13989429397492 8 4,13989429397492 9 4,30996473520857 10 4,30996473520857 11 4,45026849245099 12 4,32251521567370 13 4,32251521567370 14 4,32251521567370 15 4,28974153869163 16 4,32251521567370 17 4,51756258906766 18 4,74942794173664 19 4,74942794173664 20 4,57621696414906 21 4,51756258906766 22 4,35334832680403 23 4,32616576991108 24 4,30996473520857 1 4,20596290364125 2 4,13241078399449 3 4,13241078399449 4 4,06761746912333 5 4,06761746912333 6 4,06086643406207 7 4,20596290364125 8 4,19850762703210 9 4,25124417118600 10 4,36214866068717 11 4,45026849245099 12 4,37629784430253 13 4,33589281863478 14 4,32251521567370 15 4,32251521567370 16 4,32251521567370 17 4,50865928560725 18 4,60115716069051 19 4,60115716069051 20 4,46957360360858 21 4,41328512249549 22 4,37629784430253 23 4,32616576991108 24 4,30996473520857

Andrei Bobrov on 4 Nov 2012
Edited: Andrei Bobrov on 4 Nov 2012
a = randi(3456,52584,1); % a your hourly data
out = mean(reshape(a,24,[]));
Felipe on 12 Apr 2017
You can specify min and max values in randi function.

Raju Purohit on 4 Nov 2012
use a "for" loop. If your data values are stored in x, then
sum = 0;
for i=1:52584
sum = sum + x(i);
end
avg = sum/i;
Hope this helps.

### Categories

Find more on Loops and Conditional Statements 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!

Translated by