Finding column index of the first instance of 1
Mostra commenti meno recenti
I have a logical array like this:

I want to extrat the colum index of the cells where the first instance of 1 is detected. Like this:

For example, you see here that the first two rows show 4, because that is where 1 is first detected.
Risposta accettata
Più risposte (1)
Jonas
il 2 Mag 2022
0 voti
use the find() function together with a loop over each row
1 Commento
Pelajar UM
il 2 Mag 2022
Modificato: Pelajar UM
il 2 Mag 2022
Categorie
Scopri di più su Matrix Indexing in Centro assistenza e File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!