Find the index of the lowest number greater than zero in a vector

4 ビュー (過去 30 日間)
Erik Lenstrup
Erik Lenstrup 2016 年 8 月 22 日
コメント済み: Erik Lenstrup 2016 年 8 月 22 日
I would like to find the index of the lowest number greater than zero in a vector. ex: [0,0,4,5,0] The answer should be 3 because 4 is the third element.

採用された回答

Azzi Abdelmalek
Azzi Abdelmalek 2016 年 8 月 22 日
A(A==0)=inf
[~,idx]=min(A)

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeMatrix Indexing についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by