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

 Akzeptierte Antwort

madhan ravi
madhan ravi am 9 Nov. 2018
Bearbeitet: madhan ravi am 9 Nov. 2018

1 Stimme

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

4 Kommentare

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

Melden Sie sich an, um zu kommentieren.

Weitere Antworten (0)

Kategorien

Mehr zu Simulink finden Sie in Hilfe-Center und File Exchange

Tags

Community Treasure Hunt

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

Start Hunting!

Translated by