MATLAB: Convert 10 minute average to hourly

averagehourlyMATLAB

I have some data recorded at 10 minute interval and would like to calculate the hourly average. Some data is filtered out so using reshape is not applicable.
I could write a code to use for and if logicals but I have a lot of data and it would be to "heavy".
For each data I have the value and time (year, month, day, hour, minute (10,20 etc).
Is there a quicker way than using a long for and if code?

Best Answer

Madd = randi([10 20],50,1);
data = [datenum(2013,2,1,0,cumsum(Madd),0), randi(2500,numel(Madd),1)];
% Let your data - two columns -> [date, value]
date1 = datevec(data(:,1));
[a,~,c] = unique(date1(:,1:4),'rows');
out = [a,zeros(size(a,1),2),accumarray(c,data(:,2),[],@mean)];