Azzera filtri
Azzera filtri

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

12 visualizzazioni (ultimi 30 giorni)
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.

Risposta accettata

Azzi Abdelmalek
Azzi Abdelmalek il 22 Ago 2016
A(A==0)=inf
[~,idx]=min(A)

Più risposte (0)

Categorie

Scopri di più su Operators and Elementary Operations in Help Center e File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by