# MATLAB: How to get average of an array except considering the last element of the array

I would like to get the average of an array without considering the last element of the array.
B = A(:);out = mean(B(1:end-1));