How to find (x,y) from a matrix of Nx2?

1 回表示 (過去 30 日間)
Bishwam Pattnaik
Bishwam Pattnaik 2021 年 3 月 21 日
コメント済み: Image Analyst 2021 年 3 月 21 日
X=[5 6 9 8 4];
Y=[8 7 2 1 9];
L=[X' Y'];
Now i need to find (6,7) in that L matrix. If its not there then print 0 but if it is there print 1?
  2 件のコメント
dpb
dpb 2021 年 3 月 21 日
Use the 'rows' optional argument in ismember
Image Analyst
Image Analyst 2021 年 3 月 21 日
Are they definitely pure integers? Otherwise (floating point/fractions) use ismembertol() or simply compute the distances with pdist2() or sqrt() and pick the row with the least distance that's > 0.

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

回答 (0 件)

カテゴリ

Help Center および File ExchangeGet Started with MATLAB についてさらに検索

製品


リリース

R2020b

Community Treasure Hunt

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

Start Hunting!

Translated by