Find given element in column 1 with "find" function.

1 visualización (últimos 30 días)
Navya Snigdha Thumma
Navya Snigdha Thumma el 24 de Jul. de 2015
Comentada: bio lim el 24 de Jul. de 2015
Hello all, I am trying to use "find" function and I want to find the given number in 1st column only. For example if I have a matrix A= [ 1 1 3;1 2 3;1 2 1]; and I want to find 1's in column 1 by using P=find(A==1). My ans is P= [1;2;3;4;9] which are the indexes of 1. I want only 1st column output which should be [1;2;3]. Please help if you have any idea. Thank you.

Respuesta aceptada

bio lim
bio lim el 24 de Jul. de 2015
Editada: bio lim el 24 de Jul. de 2015
A = [ 1 1 3;1 2 3;1 2 1];
P = find(A(:,1)==1);
  2 comentarios
Navya Snigdha Thumma
Navya Snigdha Thumma el 24 de Jul. de 2015
Editada: Navya Snigdha Thumma el 24 de Jul. de 2015
Thankyou very much. It worked.
bio lim
bio lim el 24 de Jul. de 2015
Glad to help. :)

Iniciar sesión para comentar.

Más respuestas (0)

Categorías

Más información sobre Startup and Shutdown 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