MATLAB: How to delete two minimum elements in a vector

MATLAB

wonder how to delete two minimum elements in the vector and then calculate the mean value of new vector
the vector is like A=[ 70, 56 , 30, 10 , 83 , 78, 77, 90]
code should be flexibe enough to calculate for any vectors

Best Answer

EDITED
n=2; % two smallest values
u=unique(A);
if numel(u)==1 || numel(u)==2
Result=[]
else
Result=mean(A(~ismember(A,u(1:n))))
end