Finding column index of the first instance of 1
Mostrar comentarios más antiguos
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.
Respuesta aceptada
Más respuestas (1)
Jonas
el 2 de Mayo de 2022
0 votos
use the find() function together with a loop over each row
1 comentario
Pelajar UM
el 2 de Mayo de 2022
Editada: Pelajar UM
el 2 de Mayo de 2022
Categorías
Más información sobre Matrix Indexing en Centro de ayuda y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!