how to import average of monthly data from excel file?
Show older comments
hi to all:
i hope you all well be fine and doing well.
i want to import average solar radiation of each month from given excel file but the average of those data which is greather than 200 and same for weeks .
thanks
Accepted Answer
More Answers (1)
Cris LaPierre
on 16 Nov 2020
0 votes
You would either have to create a separte sheet in Excel that first calculates the monthly average, or you will need to import all the data into MATLAB and then find the monthly average
You might find groupsummary helpful, as it allows you to summarize the data by month using a method you specificy (sum, mean, max, etc), but you'll need to do all your filtering manually first.
2 Comments
Image Analyst
on 16 Nov 2020
Cris how does this groupsummary() function compare to grpstats() and splitapply()? They all seem like they do operations on identified groups of values. When would you use each instead of the other two?
Cris LaPierre
on 16 Nov 2020
Edited: Cris LaPierre
on 16 Nov 2020
Good question. I have a personal preference towards groupsummary when working with tables. I think that's just because I find it easier to use.
Age-wise, grpstats() is the oldest, and groupsummary() is the newest.
Some quick observations that may or may not hold true.
- grpstats can apply multiple stats to the input. It appears to handles tables the same as groupsummary. Said another way, groupsummary seems to be able to do everything grpstats can do.
- splitapply generally only likes a single input. It accepts tables as inputs, but each column is passed as a separte input to your summary function. If T has N variables, then func must accept N input arguments. It therefore does not run the same summary stat on every variable, which is more often the desired behavior. It also means it requires some additional work if your table contains mixed data types.
- groupsummary is perhaps an improved version of grpstats. It was designed for tables. I believe many of the capabilities have since been added to grpstats. I think a great feature of group summary is the ability to summarize by time intervals if your grouping variables is a datetime or duration.
Each of these probably has a specific use case where they may be preferred. A large part might just be what you are used to as well.
Categories
Find more on Data Import and Analysis 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!