How can I transform these data into seasonal data?
Show older comments
Hello everyone,
I should transform monthly data into seasonal data and yearly data into seasonal data: [1) December-January; 2) From March to October; 3) November; 4)February] and then doing the average.
Can anyone help me kindly?
Thank you.
6 Comments
Wan Ji
on 15 Aug 2021
What do all the mat files mean by their names, not so clear
Scott MacKenzie
on 15 Aug 2021
Edited: Scott MacKenzie
on 15 Aug 2021
I believe you have asked this question before, and it has been answered (click here). Please explain how this new question differs from the previous question.
Pul
on 16 Aug 2021
Scott MacKenzie
on 16 Aug 2021
OK, I get it. You are now working with new data which are organized differently. Well, step #1 is always to know and understand the organization of the data you are working with. Some fiddling might be necessary to get the data organized in a way that suits your purpose.
The load command in your comment loads data into a table (not a timetable). Upon inspection, I notice there is no datetime column, so you'll have to make one. In this case, columns 1 and 2 are 'Year' and 'Month'. So, you need to make and add a datetime column from these columns. Then you can convert to a timetable, and continue with the code in the answer to your earlier question; i.e., define your seasons, use grpstats to get seasonal summaries, plot, etc.
Here's some code to get you started with the data in your comment.
load('DATI_MAR_mensili');
% NOTE: loads a table with 'Year' and 'Month' columns
% add date/time column labeled 'Time'
DATIMARmensili.Time = datetime(DATIMARmensili.Year, DATIMARmensili.Month, 0);
% convert to timetable with all the other data columns
DATI_MAR_SEASON = table2timetable(DATIMARmensili(:,3:end));
% define seasons, as in previous question/answer, and continue
Scott MacKenzie
on 16 Aug 2021
OK, I'll also put the code from my comment into answer box.
Accepted Answer
More Answers (0)
Categories
Find more on Descriptive Statistics and Visualization 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!