Filter löschen
Filter löschen

Reorder Sets of Coordinates into Continuous Path

1 Ansicht (letzte 30 Tage)
Jake Smith
Jake Smith am 26 Apr. 2019
Say I have a series of coordinates represented by matrices:
%[x1 y1; x2 y2;...]
a = [0 0; 2 3; 4 5; 5 4];
b = [0 0; 4 2; 5 5; 1 1];
c = [2 2; 6 7; 3 3; 1 1];
I would like to reorder them to form a continous path in the correct order without repeats, i.e.
aNew = [5 4; 4 5; 2 3; 0 0];
bNew = b; %remains the same since the end of "aNew" is the start of "b"
cNew = [1 1; 3 3; 6 7; 2 2];
compiled = [5 4; 4 5; 2 3; 0 0; 4 2; 5 5; 1 1; 3 3; 6 7; 2 2];
The "start" and "end" coordinates aren't a concern; "a" and "c" in the example above could stay the same while only "b" is rearranged. Is there an efficient MATLAB indexing method to reorder and compile the coordinates?

Antworten (0)

Kategorien

Mehr zu Matrix Indexing finden Sie in Help Center und File Exchange

Produkte


Version

R2017a

Community Treasure Hunt

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

Start Hunting!

Translated by