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

조회 수: 2 (최근 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 CenterFile Exchange에서 Get 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