MATLAB: Find out the mean of each year and month from temperature data of 1890-2018

time seriestimetable

How can I find out the mean of the temperature of each year if I have a big dataset 1890-2018. I would also like to separate the data in to 12 months for all the year to see the seasonal variation. The year of the data has already shown as the Matlab time. I do not know how the select the data of each year to find the mean.

Best Answer

If you have your data stored in a timetable, use the retime function. Use the "Aggregate Timetable Data and Calculate Mean Values" example on the retime documentation page as a model, changing how it aggregates the data from 'hourly' to 'monthly' or 'yearly'.
Related Question