Finding ALL the indicies that match a certain value

3 ビュー (過去 30 日間)
Abbi Hashem
Abbi Hashem 2018 年 12 月 10 日
回答済み: Star Strider 2018 年 12 月 10 日
Suppose I have a variable A= 4
and I have a vector B = [ 3 5 4 6 4 6 7 ]
I want to find the index of B that match A
that is , a vector with [ 3 , 5 ] since they are the third and 5th

回答 (1 件)

Star Strider
Star Strider 2018 年 12 月 10 日
Use the find function:
A = 4;
B = [ 3 5 4 6 4 6 7 ];
idx = find(B == A)
producing:
idx =
3 5

カテゴリ

Help Center および File ExchangeCreating and Concatenating Matrices についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by