MATLAB Answers

BOB
0

Reshape matrix whilst maintaining pairs ordering

Asked by BOB
on 22 Aug 2018
Latest activity Commented on by Star Strider
on 22 Aug 2018
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

  0 Comments

Sign in to comment.

1 Answer

Answer by Star Strider
on 22 Aug 2018
 Accepted Answer

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 Comments

Yeah it does, cheers.

Sign in to comment.