필터 지우기
필터 지우기

Reorder Sets of Coordinates into Continuous Path

조회 수: 1 (최근 30일)
Jake Smith
Jake Smith 2019년 4월 26일
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?

답변 (0개)

카테고리

Help CenterFile Exchange에서 Matrix Indexing에 대해 자세히 알아보기

제품


릴리스

R2017a

Community Treasure Hunt

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

Start Hunting!

Translated by