Here's the trick:
M = npp_data_pft1(:, 1, 33:47, 112:176);
mean(reshape(M,[],size(M,3)*size(M,4))');
In this example the answer will output values each with the mean of the region you selected per frame. I reshaped the 4D matrix to a 2D one. That matrix has 100 lines (total # of frames) and 975 columns (total # of pixels in the selected region). Then just using mean
on that 2D matrix will yield the mean value of the entire region per frame. (I used '
to get the mean working in the right dimension, instead you can use mean(...,2)
)