MATLAB: I need to reshape rows that are in complicated manner!

reshaperows into columns

I have data in rows which is a bit complicated to arrange i need a code that will arrange in columns.
Example:
If A=
[1 3 5 7 9
2 4 6 8 10
1 3 5 7 9
2 4 6 8 10
1 3 5 7 9
2 4 6 8 10
1 3 5 7 9
2 4 6 8 10]
thats what data looks like. 1 and 2 rows contains data of same category so i want them to be arranged in a single column,same goes for the other three pairs in total i need 4 columns. but the reshaping command will put the 2nd column 1st value exactly after last value.

Best Answer

The number of rows in A must be even.
n = size(A,2);
B = reshape(A.,2*n,[]);
B = B(ceil((1:2*n)/2)+n*mod(0:2*n-1,2),:);