MATLAB: Calculate average for each hour in day

24hour intervalaverage over 24 hoursaverage per hourdatetimein a yearMATLABtimedata

I have a bunch of data in datetime format similar to this:
2010-Nov-30 18:00.00 0 8.7 17.05 61.38
I have summed all the data into hours, but I would like to calculate the average at every hour 00:00, 01:00, 02:00… 23:00 for every day in the year.
I have data for a whole year, so I'm interested in seeing the average values in a day, per hour, with the data from the whole year.
I've tried to use retime but I can't really get it to function correctly. Maybe it's the wrong function for this purpose.

Best Answer

IIUC, retime is not the tool for this; it bins data into desired time segments such as hourly but averages within those bins.
To compute an average of all observations in the dataset at each exact hour, use a grouping variable and varfun or groupsummary or grpsummary (latter requires Statistics Toolbox and has essentially been replaced by former in base MATLAB).
You will have to group by sufficiently-fine resolution to isolate the one actual top-oif-the-hour reading by hours(), minutes(), seconds(), ... depending upon the time-of-day readings in the dataset.