MATLAB: Changes matrix size matlab

binaryMATLABmatrixrow

i generate this binary (16×1) :
A = randi ([0 1], 16,1);
and the result is :
0
0
0
1
1
0
1
0
0
0
1
1
0
0
0
1
My question is, how to make the matrix A become 2×8 matrix? So, the result like :
0 0 0 1 1 0 1 0
0 0 1 1 0 0 0 1
Thanks before

Best Answer

Use the reshape function, specifically:
Out = reshape(A, [], 2)'
producing (for the vector you posted):
Out =
0 0 0 1 1 0 1 0
0 0 1 1 0 0 0 1