MATLAB: Is there any instruction can ignore the “0” value and find the minimum value of a matrix

MATLAB

Is there any instruction can ignore the "0" value and find the minimum value of a matrix ? I mean ,if i assume
A=[0 1 2 3]
How do i write the code to let the minimum value is 1 instead of 0

Best Answer

A=[0 1 2 3]
[val,idx] = sort(A) ;
iwant = val(2)
A(A==0) = NaN
min(A)
Related Question