Code -
% Edit this based on your choice of starting from 00:00 or from the first entry
start_from_0000 = false;
% Performing Code
datenum_mins = datenum(time)*24*60;
if start_from_0000
start1 = floor(datenum(time(1)))*24*60;
ind_15min_periods = floor((datenum_mins - start1)./15)+1;
else
ind_15min_periods = floor((datenum_mins - datenum_mins(1))./15)+1;
end
mean_dat = zeros(max(ind_15min_periods),1);
for c1 = 1:max(ind_15min_periods)
mean_dat(c1) = mean(dat(ind_15min_periods==c1));
end