Filter löschen
Filter löschen

A program that finds the same coordinate

2 Ansichten (letzte 30 Tage)
Marco Camozzi
Marco Camozzi am 20 Apr. 2020
Kommentiert: Tommy am 20 Apr. 2020
Hi,
Could someone help me find a program or function that checks if there is a matching coordinate pair in this coordinate list?
The matrix used are like this one.
XY = [0 0;
1 0;
2 0;
3 0;
0 -1;
1 -1;
2 -1;
3 -1];
Thank you so much!
  1 Kommentar
Tommy
Tommy am 20 Apr. 2020
If you are perhaps looking to compare pairs of coordinates, rather than compare the values within each pair:

Melden Sie sich an, um zu kommentieren.

Akzeptierte Antwort

Ameer Hamza
Ameer Hamza am 20 Apr. 2020
Bearbeitet: Ameer Hamza am 20 Apr. 2020
Something like this
XY = [0 0;
1 0;
2 0;
3 0;
0 -1;
1 -1;
2 -1;
3 -1];
mask = XY(:,1)==XY(:,2);
matching_pairs = XY(mask, :);
Result:
matching_pairs =
0 0

Weitere Antworten (0)

Kategorien

Mehr zu Loops and Conditional Statements finden Sie in Help Center und File Exchange

Produkte


Version

R2019b

Community Treasure Hunt

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

Start Hunting!

Translated by