Find minimum (or maximum, etc.) non-zero entry in a sparse matrix in MATLAB

Alec Jacobson

November 02, 2011

weblog/

Actually this should also work for dense matrices, that is it will give you the smallest entry in the matrix not equal to zero.
  min(A(find(A)))