I have measured a handful of variables in 30 minute intervals. Time stamps are available in datevec or datenum format. I want to calculate ...
Considering that datevec() output is stored in tvec and data in x, group with unique(...,'rows') and accumulate with accumarray():
% Group by day
[unDates, ~, subs] = unique(tvec(:,1:3),'rows');
% Accumulate by day
[unDates accumarray(subs, x, [], @mean)]
% Similarly by hour
[unHours, ~, subs] = unique(tvec(:,4:5),'rows');
[unHours accumarray(subs, x, [], @mean)]