MATLAB Answers

TAKING [X1 X2 …] and [Y1 Y2 …] and reshaping them into [Y1 X1 Y2 X2 …]

조회 수: 1(최근 30일)
mark palmer
mark palmer 19 Jun 2020
답변: the cyclist 19 Jun 2020
I would like to take 2 1D arrays [X1 X2 …] and [Y1 Y2 …] and reshape them into a [Y1 X1 Y2 X2 …] array for use as polygon vertices in insertShape.
For instance
x = [1 3 8];
y = [9 5 7];
xy = [9 1 5 3 7 8];
I already have figured out some long, stupid, time-consuming ways to do this, but I'm curious if there's an easy, efficient way to do this that somebody is doing.

  댓글 수: 0

댓글을 달려면 로그인하십시오.

채택된 답변

the cyclist
the cyclist 19 Jun 2020
xy = reshape([y;x],1,[]);

  댓글 수: 0

댓글을 달려면 로그인하십시오.

추가 답변(0개)

태그

제품


릴리스

R2018b

Community Treasure Hunt

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

Start Hunting!

Translated by