Reshape matrix whilst maintaining pairs ordering

조회 수: 6 (최근 30일)
BOB
BOB 2018년 8월 22일
댓글: Star Strider 2018년 8월 22일
Hi, I have a 2 x 120 matrix which I'm trying to reshape to a 120 x 2 matrix.
To do this I'm using the following code:
y = reshape(y2, 120, 2);
But the code seems to mess up the pairs i.e. the pairs in the original form (2 x 120) are not the same as in the reshaped form (120 x 2).
If anyone could help with how to keep the ordering whilst simply reshaping the matrix that would be great.
Thanks,
Chris

채택된 답변

Star Strider
Star Strider 2018년 8월 22일
It always helps to have an example of the matrix you are starting with, and your intended result.
Does the transpose, .' (link) function (or operation) do what you want?
  댓글 수: 2
BOB
BOB 2018년 8월 22일
Yeah it does, cheers.
Star Strider
Star Strider 2018년 8월 22일
Cheers!

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

추가 답변 (0개)

카테고리

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

Community Treasure Hunt

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

Start Hunting!

Translated by