From: Catalin Eberhardt on
Hi everyone!

Say I have a 6x6 matrix - what is the easiest way of moving the rightmost 3 columns below the leftmost 3 columns, such that the matrix becomes 12x3?

Thanks for any help!
From: Nathan on
On May 5, 3:51 pm, "Catalin Eberhardt" <longtal...(a)gmail.com> wrote:
> Hi everyone!
>
> Say I have a 6x6 matrix - what is the easiest way of moving the rightmost 3 columns below the leftmost 3 columns, such that the matrix becomes 12x3?
>
> Thanks for any help!

A = magic(6);
B = [A(:,1:3);A(:,4:6)]

or:
B = [reshape(A(:,1:3:end),[],1) reshape(A(:,2:3:end),[],1) reshape(A(:,
3:3:end),[],1)]


-Nathan
From: Walter Roberson on
Catalin Eberhardt wrote:

> Say I have a 6x6 matrix - what is the easiest way of moving the
> rightmost 3 columns below the leftmost 3 columns, such that the matrix
> becomes 12x3?

Easiest:

[C(:,1:3);C(:,4:6)];

More generally:

[C(:,1:end/2);C(:,end/2+1:end)]
From: Catalin Eberhardt on
Thanks a lot!!