MATLAB: How to detect ones and its location in a column

matricesmatrixvector

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]

Best Answer

in your case (for vector):
location = find(A);