MATLAB: Taking mean without max values

mean max

Hello, How would I take the mean value of a matrix and exclude only the one max value?
Thanks

Best Answer

x=[1,2,3;4,5,6;7,8,500];
mean_value=(sum(x(:))-max(x(:)))/(numel(x)-1);
For 1d vectors rather than a matrix, you can exclude the (:) portions.
Related Question