Effacer les filtres
Effacer les filtres

Reorder Sets of Coordinates into Continuous Path

1 vue (au cours des 30 derniers jours)
Jake Smith
Jake Smith le 26 Avr 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?

Réponses (0)

Catégories

En savoir plus sur Matrix Indexing dans Help Center et File Exchange

Produits


Version

R2017a

Community Treasure Hunt

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

Start Hunting!

Translated by