MATLAB: How to rearrange data in matrix

matrix array

if I have A=[1:15].
After that, I want to rearrange matrix A to get a result: MyResult=[1 2 3 4 5; 6 7 8 9 10; 11 12 13 14 15];
How can I code to get the result like this ?

Best Answer

>> A = 1:15;
>> reshape(A,5,3).'
ans =
1 2 3 4 5
6 7 8 9 10
11 12 13 14 15
>>