MATLAB - re-arrange matrix by vertically concatenating submatrices -


i having trouble following task: suppose 3x6 matrix:

a =

0.2787    0.2948    0.4635    0.8388    0.0627    0.0435 0.6917    0.1185    0.3660    0.1867    0.2383    0.7577 0.6179    0.7425    0.0448    0.4009    0.9377    0.4821 

what divide matrix blocks, this:

a =

0.2787    0.2948  |  0.4635    0.8388  |  0.0627    0.0435 0.6917    0.1185  |  0.3660    0.1867  |  0.2383    0.7577 0.6179    0.7425  |  0.0448    0.4009  |  0.9377    0.4821 

and vertically concatenate these blocks final result:

0.2787    0.2948  0.6917    0.1185   0.6179    0.7425   0.4635    0.8388 0.3660    0.1867 0.0448    0.4009 0.0627    0.0435 0.2383    0.7577 0.9377    0.4821 

i think if can this, can perhaps arbitrary matrices a. can solve above problem using for-loops, looking vectorised solution.

thanks in advance! n.

consider following:

a = rand(3,6); blksz = 2;  c = mat2cell(a, size(a,1), blksz*ones(1,size(a,2)/blksz)); c = cat(1,c{:}) 

this assumes size(a,2) evenly divisible blksz


Comments

Popular posts from this blog

jquery - Invalid Assignment Left-Hand Side -

java - Play! framework 2.0: How to display multiple image? -

gmail - Is there any documentation for read-only access to the Google Contacts API? -