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

2 visualizzazioni (ultimi 30 giorni)
Bishwam Pattnaik
Bishwam Pattnaik il 21 Mar 2021
Commentato: Image Analyst il 21 Mar 2021
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 Commenti
dpb
dpb il 21 Mar 2021
Use the 'rows' optional argument in ismember
Image Analyst
Image Analyst il 21 Mar 2021
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.

Accedi per commentare.

Risposte (0)

Categorie

Scopri di più su Data Type Conversion in Help Center e File Exchange

Prodotti


Release

R2020b

Community Treasure Hunt

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

Start Hunting!

Translated by