Let data - your array [978 x 744].
For MATLAB >= R2016b (here week -> [Sun : Sat]):
Time = (datetime([2017 7 1 0 0 0]):hours(1):datetime([2017 7 31 23 0 0]))';
TT = array2timetable(data','R',Time);
TT_out = retime(TT,'weekly','mean');
For MATLAB < R2016b ( here week -> [Mon : Sun]):
data = data';
Time = (datetime([2017 7 1 0 0 0]):hours(1):datetime([2017 7 31 23 0 0]))';
wd = rem(weekday(Time) + 5, 7) + 1;
ii = [true;diff(wd == 1) == 1];
g = cumsum(ii);
[r,c] = ndgrid(g,1:size(TT,2));
TT_out = [table(Time(ii),'V',{'Time'}),...
array2table(accumarray([r(:),c(:)],data(:),[],@mean))];
Best Answer