function y = mymean(x)
%MYMEAN   Average or mean value.
%   For vectors, MYMEAN(X) is the mean value of the elements in X. For
%   matrices, MYMEAN(X) is a row vector containing the mean value of
%   each column.  For N-D arrays, MYMEAN(X) is the mean value of the
%   elements along the first non-singleton dimension of X.

[m,n] = size(x);
if m == 1
   m = n;
end
y = sum(x)/m;