From: Catalin Eberhardt on 5 May 2010 18:51 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 5 May 2010 19:09 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 5 May 2010 19:12 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 5 May 2010 19:17 Thanks a lot!!
|
Pages: 1 Prev: uniform random variable Next: operations on multiple files |