Monthly Average from Daily Data
12 views (last 30 days)
Show older comments
I hava daily weather dataset and I need the montly average. However, I need the average of a user input. For example when prompted to enter a month 'Jan' It will display the average temperature for January.
0 Comments
Answers (2)
Akira Agata
on 7 May 2020
The following is an example (note that the follwing returns average value with nanflag = 'omitnan').
T = readtable('BTVHistoricData (3).csv');
T.DATE = datetime(T.DATE,'InputFormat','yyyy-MM');
T.Month = T.DATE.Month;
Tavg = groupsummary(T(:,4:end),'Month','mean');
>> Tavg
Tavg =
12×6 table
Month GroupCount mean_AWND mean_DT32 mean_SNOW mean_TAVG
_____ __________ _________ _________ _________ _________
1 77 9.1973 29.442 19.727 18.327
2 76 8.6639 26.737 17.357 20.039
3 76 8.8861 26.197 14.132 30.342
4 76 8.9306 14.25 3.8382 43.763
5 76 8.2361 2.1711 0.11081 56.23
6 77 7.6611 0 0 65.603
7 77 7.0611 0 0 70.521
8 77 6.9194 0 0 68.462
9 77 7.4333 0.58442 0.0013889 60.208
10 77 8.1111 7.6753 0.25342 48.691
11 77 9.0472 18.156 6.4896 37.508
12 77 8.9167 27.61 18.648 24.647
0 Comments
See Also
Categories
Find more on Data Distribution Plots 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!