MATLAB: How to find minimum number in array other than 0 and 1

minimum in array other than 0 and 1

If i have to find minimum other that 0 and 1 in an array like A=[ 0 0 0 1 0 0 10 0 30]; I want to find min(A(A>0 && A>1)) but it is showing error : Operands to the and && operators must be convertible to logical scalar values.

Best Answer

out = min(A(~ismember(A,0:1)));
or
out = min(setdiff(A,0:1));
or
out = min(A( A ~= 0 & A ~= 1 ));