Find minimum in matrice
古いコメントを表示
Hey guys, thanks in advance
I have this matrix, that always has zeros, but also other values. I want to find the minimum of the matrix, besides the zeros, how can I do that?
採用された回答
その他の回答 (1 件)
Let A be your matrix.
A(A==0) = NaN ; % replace 0's with NaNs
[val,idx] = min(A)
Or, use:
val = min(A(A>0))
カテゴリ
ヘルプ センター および File Exchange で Matrices and Arrays についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!