Hi,
You can follow a similar approach to the one you used for the annual mean. Instead of averaging over all 12 months, you will only average over the months of interest. Following is a general approach:
- Reshape the array to separate the years and months.
- Extract the months of interest (June, July, August).
- Compute the mean over these months.
Here is the MATLAB code:
% Assuming B is your original 3D array (lat x lon x month)
% Reshape the array to separate years and months
B_reshaped = reshape(B, [s(1), s(2), 12, s(3)/12]);
% Extract the months of interest (June, July, August) i.e., 6:8
JJA_months = B_reshaped(:,:,6:8,:);
% Compute the mean over the months of interest
JJA_mean = squeeze(nanmean(JJA_months, 3));
Hope this helps!