MATLAB: Reshape does not Use the Columns I Want

reshape

So, I have a matrix x=
1 2 3 4
5 6 7 8
9 10 11 12
13 14 15 16
17 18 19 20
I want to create a 2-column matrix with indefinite numbers of rows and to do that I use
reshape(x,[],2). The result I get is
1 3
5 7
9 11
13 15
17 19
2 4
6 8
10 12
14 16
18 20
But I'd like to have
1 2
5 6
9 10
13 14
17 18
3 4
7 8
11 12
15 16
19 20
What can I do?

Best Answer

For your posted example, simply
[x(:,1:2);x(:,3:4)]
But this begs the question, what is your real problem and what sizes can x be? Always 4 columns or any number of even columns or ???