Consider the following example
% some fake data
A = reshape(1:256,16,[]);
A = A + 10*randn(size(A));
[min(A(:)) max(A(:))] % just show what the data range is
% unless levels are known explicitly
% get them from the contour plot
[~,hc] = contourf(A); hold on
% first level corresponds to data minimum
% last level rarely corresponds to data maximum
ll = hc.LevelList
% so make sure there are consistently enough boundaries to cover the data range
mx = max(A(:));
if mx > ll(end)
ll = [ll mx];
end
ll % the full level list (the region boundaries)
% get the mean value of each region
nregions = numel(ll)-1;
lvlmean = zeros(1,nregions);
for k = 1:nregions
if k < nregions
% each region in a contourf() plot
% is associated with the lower boundary of the region
mask = (A >= ll(k)) & (A < ll(k+1));
else
% make sure to include maximum values
mask = (A >= ll(k)) & (A <= ll(k+1));
end
lvlmean(k) = mean(A(mask));
end
lvlmean
... or you could choose to handle the region conditionals symmetrically if you wanted. That's up to you.