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 日

1 投票

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

4 件のコメント

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

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

ヘルプ センター および File ExchangeSimulink についてさらに検索

タグ

質問済み:

2018 年 11 月 9 日

コメント済み:

2018 年 11 月 9 日

Community Treasure Hunt

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

Start Hunting!

Translated by