How to find the location of a zero (or a different number) in a vector ?
like :
a=[ 1 3 5 6 34 4 0 1 3 4 50]
=>7

 Respuesta aceptada

madhan ravi
madhan ravi el 9 de Nov. de 2018
Editada: madhan ravi el 9 de Nov. de 2018

1 voto

a=[ 1 3 5 6 34 4 0 1 3 4 50]
index=find(a==0)

4 comentarios

IBM watson
IBM watson el 9 de Nov. de 2018
Thanks!!
madhan ravi
madhan ravi el 9 de Nov. de 2018
Anytime :)
Stephen23
Stephen23 el 9 de Nov. de 2018
Note that often logical indexing is more efficient than using find.
IBM watson
IBM watson el 9 de Nov. de 2018
I will take a look. Thanks :)

Iniciar sesión para comentar.

Más respuestas (0)

Categorías

Más información sobre Simulink en Centro de ayuda y File Exchange.

Etiquetas

Preguntada:

el 9 de Nov. de 2018

Comentada:

el 9 de Nov. de 2018

Community Treasure Hunt

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

Start Hunting!

Translated by