Sum loop inside a large vector
1 vue (au cours des 30 derniers jours)
Afficher commentaires plus anciens
Hi everyone!
I have 5 years with hourly data from a meteorological station (24 hours x 365 days x 5 years= 43800 data in total of wind speed).
I would like to do a 24 hours summation loop during the five years, in order to get the sum of wind speed by each day.
For example, look at the next data:
2010 1 1 0 0.17592594
2010 1 1 1 0.07407408
2010 1 1 2 0
2010 1 1 3 0.16203705
2010 1 1 4 0.07407408
2010 1 1 5 0.25000002
2010 1 1 6 0
2010 1 1 7 0.14814816
2010 1 1 8 0
2010 1 1 9 0.07407408
2010 1 1 10 0
2010 1 1 11 0
2010 1 1 12 0.14814816
2010 1 1 13 0.68518524
2010 1 1 14 3.43981509
2010 1 1 15 5.06944485
2010 1 1 16 5.42129673
2010 1 1 17 4.82407446
2010 1 1 18 5.23611153
2010 1 1 19 5.24074116
2010 1 1 20 3.74074104
2010 1 1 21 3.8888892
2010 1 1 22 2.76388911
2010 1 1 23 2.78240763
2010 1 2 0 2.39351871
2010 1 2 1 2.29629648
2010 1 2 2 2.02314831
2010 1 2 3 2.00000016
2010 1 2 4 2.70833355
2010 1 2 5 2.53703724
2010 1 2 6 2.43518538
2010 1 2 7 2.16666684
2010 1 2 8 3.55555584
2010 1 2 9 3.77777808
2010 1 2 10 3.46296324
2010 1 2 11 3.11111136
2010 1 2 12 2.98611135
2010 1 2 13 2.68981503
2010 1 2 14 2.43055575
2010 1 2 15 2.12037054
2010 1 2 16 3.36574101
2010 1 2 17 3.15740766
2010 1 2 18 2.22685203
2010 1 2 19 3.37037064
2010 1 2 20 3.6111114
2010 1 2 21 3.18981507
2010 1 2 22 3.31944471
2010 1 2 23 2.51851872
2010 1 3 0 1.98148164
2010 1 3 1 1.26388899
2010 1 3 2 0.57870375
2010 1 3 3 0.6018519
2010 1 3 4 0.95833341
2010 1 3 5 0.69907413
2010 1 3 6 0.86574081
2010 1 3 7 0.77314821
2010 1 3 8 1.21759269
2010 1 3 9 1.52314827
2010 1 3 10 1.78703718
2010 1 3 11 2.17129647
2010 1 3 12 2.25462981
2010 1 3 13 2.27777796
2010 1 3 14 2.37500019
2010 1 3 15 2.13425943
2010 1 3 16 2.12500017
2010 1 3 17 2.13888906
2010 1 3 18 2.2222224
2010 1 3 19 2.06944461
2010 1 3 20 1.96296312
2010 1 3 21 2.21296314
2010 1 3 22 1.29166677
2010 1 3 23 1.98148164
2010 1 4 0 2.42129649
2010 1 4 1 1.46759271
2010 1 4 2 1.24537047
2010 1 4 3 1.60648161
2010 1 4 4 1.43981493
2010 1 4 5 0.47222226
2010 1 4 6 0.28240743
2010 1 4 7 0
2010 1 4 8 0
2010 1 4 9 0.27314817
2010 1 4 10 0.79166673
2010 1 4 11 1.34722233
2010 1 4 12 1.07407416
2010 1 4 13 2.75462985
2010 1 4 14 2.93518542
2010 1 4 15 3.07870395
2010 1 4 16 3.07870395
2010 1 4 17 2.81944467
2010 1 4 18 2.49537057
2010 1 4 19 2.61574095
2010 1 4 20 2.99074098
2010 1 4 21 3.10648173
2010 1 4 22 3.04629654
2010 1 4 23 3.3796299
In the table of above, the fourth column corresponds to the hour and the fifth corresponds to the wind speed measurement. At the end, is necessary generate the next output (daily wind speed sum).
2010 1 1 44.19907761
2010 1 2 67.4537091
2010 1 3 39.46759575
2010 1 4 44.7222258
Thanks in advance for your support!
1 commentaire
Réponse acceptée
Jan
le 22 Sep 2016
WindPerDay = sum(reshape(Data(:, 5), 24, []), 1);
Result = cat(2, Data(:, 1:3), WindPerDay(:));
1 commentaire
Voir également
Catégories
En savoir plus sur Language Fundamentals dans Help Center et File Exchange
Produits
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!