You could just use the filter
function, though I assume you already got your data in a proper format (1D-vector)
hours = 8; % size of hour window defining the moving average
movAV = filter(ones(1,hours)/hours,1,O3_data);
For the daily maximum you need to split your "hour"-vector and movAV
in 24h brackets. Assuming you have one value per hour you could just reshape your result into a 24 x N
array:
%example
x = 1:240; %d ata for 10 days
y = reshape(x,24,[])
then use the additional parameters of the max function to search the max columnwise:
% in this case the max is always the last value of every day
dailyMax = max(y,[],1)
dailyMax =
24 48 72 96 120 144 168 192 216 240
respectively:
dailyMax = max(reshape(movAV,24,[]),[],1)
Probably for your case the most convenient would be to use findpeaks
which would directly output all local maxima (Signal Processing Toolbox required).