How do I trace the points with a "snake" pattern?
조회 수: 4 (최근 30일)
이전 댓글 표시
I want to start at the top left yellow point, trace up with a curve to the corresponding left orange point. Shift to the right and follow the same pattern back down to the second corresponding yellow point. Shift right go up and repeat until all points are used.
(the black circle is to show the start of the triangular figure, I do not need it in my tracing.)
댓글 수: 0
답변 (1개)
Image Analyst
2022년 7월 27일
% Sort the yellow data from right to left.
[yellowx, sortOrder] = sort(yellowx(:), 'descend');
% sort y the same way.
yellowy = yellowy(sortOrder)'; % Column vector.
% Sort the orange data from left to right.
[orangex, sortOrder] = sort(orangex(:), 'ascend');
% sort y the same way.
orangey = orangey(sortOrder)'; % Column vector.
xBoth = [yellowx; orangex];
yBoth = [yellowy; orangey];
plot(xBoth, yBoth, 'k-', 'LineWidth', 2);
grid on;
댓글 수: 0
참고 항목
카테고리
Help Center 및 File Exchange에서 Shifting and Sorting Matrices에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!