Borrar filtros
Borrar filtros

How to detect ones and its location in a column

1 visualización (últimos 30 días)
fyza affandi
fyza affandi el 19 de Nov. de 2018
Editada: Andrei Bobrov el 19 de Nov. de 2018
I have matrix A,
A= [0 0 0 0 0 1 1 0 0 0]
How can I detect the ones in the vector and also its location in a column?
The result should be
location = [6 7]

Respuesta aceptada

Andrei Bobrov
Andrei Bobrov el 19 de Nov. de 2018
Editada: Andrei Bobrov el 19 de Nov. de 2018
in your case (for vector):
location = find(A);

Más respuestas (0)

Categorías

Más información sobre Matrices and Arrays en Help Center y File Exchange.

Community Treasure Hunt

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

Start Hunting!

Translated by