Is there any instruction can ignore the "0" value and find the minimum value of a matrix ?

2 ビュー (過去 30 日間)
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

採用された回答

KSSV
KSSV 2019 年 4 月 2 日
編集済み: KSSV 2019 年 4 月 2 日
A=[0 1 2 3]
[val,idx] = sort(A) ;
iwant = val(2)
A(A==0) = NaN
min(A)

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeArgument Definitions についてさらに検索

タグ

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by