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

 采纳的回答

madhan ravi
madhan ravi 2018-11-9
编辑:madhan ravi 2018-11-9
a=[ 1 3 5 6 34 4 0 1 3 4 50]
index=find(a==0)

4 个评论

Thanks!!
Anytime :)
Note that often logical indexing is more efficient than using find.
I will take a look. Thanks :)

请先登录,再进行评论。

更多回答(0 个)

类别

帮助中心File Exchange 中查找有关 Simulink 的更多信息

标签

Community Treasure Hunt

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

Start Hunting!

Translated by