A couple of calls to convn. The first call will determine the number of zeros; the second will calculate the sum of all values in the sub array; array divide the second by the first.
If you don't want to do it to EVERY POSSIBLE subarray, use blkproc or blockproc with function handle
@(x)sum(x(:))./(sum(logical(x(:)))
Also be aware that since your data type is uint32, if the sum of the 92*92*4 values exceeds 4,294,967,295 it will truncate to 4,294,967,295 and your mean will be wrong.
Best Answer