Average or mean value of array
M = mean(A)
M = mean(A,dim)
If A is a vector, mean(A) returns the mean value of A.
If A is a matrix, mean(A) treats the columns of A as vectors, returning a row vector of mean values.
If A is a multidimensional array, mean(A) treats the values along the first non-singleton dimension as vectors, returning an array of mean values.
A = [1 2 3; 3 3 6; 4 6 8; 4 7 7]; mean(A) ans = 3.0000 4.5000 6.0000 mean(A,2) ans = 2.0000 4.0000 6.0000 6.0000