フィルターのクリア

Finding position of values which are equal to some value

3 ビュー (過去 30 日間)
stelios loizidis
stelios loizidis 2023 年 4 月 7 日
コメント済み: stelios loizidis 2023 年 4 月 10 日
Hello,
I am trying to find the position of values in the ND matrix (1X1800) which are equal to the val matrix (1X6) according to the code below. How can this be done for all values in val matrix in an easy way (i.e. val(2), val(3),...val(6))?
Your help is important.
[val,pos]=intersect(ND,NeD); % val: 1X6, pos:6X1, ND: 1X1800, NeD:1X200
[z1,zz1]=find(ND==val(1));

採用された回答

KALYAN ACHARJYA
KALYAN ACHARJYA 2023 年 4 月 7 日
編集済み: KALYAN ACHARJYA 2023 年 4 月 7 日
ND=randi(100,[1,1800]); % Random data just for testing
val=randi(100,[1,16]); % Random data just for testing
[common_val,idx]=intersect(ND,val,'stable')
  1 件のコメント
stelios loizidis
stelios loizidis 2023 年 4 月 10 日
It works. Thanks for valuable help.

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

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeHypothesis Tests についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by