Filter löschen
Filter löschen

How to detect ones and its location in a column

1 Ansicht (letzte 30 Tage)
fyza affandi
fyza affandi am 19 Nov. 2018
Bearbeitet: Andrei Bobrov am 19 Nov. 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]

Akzeptierte Antwort

Andrei Bobrov
Andrei Bobrov am 19 Nov. 2018
Bearbeitet: Andrei Bobrov am 19 Nov. 2018
in your case (for vector):
location = find(A);

Weitere Antworten (0)

Kategorien

Mehr zu Matrices and Arrays finden Sie in Help Center und File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by