First minimum larger than zero

3 ビュー (過去 30 日間)
ph
ph 2022 年 2 月 7 日
コメント済み: ph 2022 年 2 月 7 日
Hi,
I'd like to know the first index (and eventually the value) of the minimum element larger than zero in a vector.
Exemple : a=[14,9,4,-1,-6,-11,9,4,-1] , I look for "3" (and eventually the value = 4)
Any suggestion is kindly appreciated
thanks
ph

採用された回答

KSSV
KSSV 2022 年 2 月 7 日
a=[14,9,4,-1,-6,-11,9,4,-1] ;
[val,idx] = min(abs(a))
val = 1
idx = 4
  5 件のコメント
KSSV
KSSV 2022 年 2 月 7 日
Thanks is accepting/ voting the answer. :)
ph
ph 2022 年 2 月 7 日
Okok, needed to figure it out. Then you can edit the first answer with the comment you did after ;-)

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeMultirate Signal Processing についてさらに検索

製品


リリース

R2020b

Community Treasure Hunt

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

Start Hunting!

Translated by