Finding the row/column locations of 1s in a boolean matrix

I have a Boolean matrix and I would like to find the row/column locations of all of the ones within the matrix. How might I go about doing this?

 Respuesta aceptada

Matt Fig
Matt Fig el 24 de Nov. de 2012
Editada: Matt Fig el 24 de Nov. de 2012
A = rand(3)>.5;
[I,J] = find(A) % I is the rows, J is the cols.

Más respuestas (0)

Categorías

Más información sobre Creating and Concatenating Matrices en Centro de ayuda y File Exchange.

Etiquetas

Preguntada:

el 24 de Nov. de 2012

Community Treasure Hunt

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

Start Hunting!

Translated by