I am working with pretty big arrays of data, but here I'll consider a toy example.
Suppose a is 6x3 array:
a=[1,2,3;4,5,6;7,8,9;10,11,12;13,14,15;16,17,18]
I want to reshape it to the array of size (3,3,2) by horizontal slices, so that the resulting array b would be:
b(:,:,1)= [1,2,3;4,5,6;7,8,9]
b(:,:,2)= [10,11,12;13,14,15;16,17,18]
I was trying to do it with the reshape function: b=reshape(a,[3,3,2]) , however, the resulting array is different (in goes though columns first).
I didn't really find the appropriate options for the reshape function.
Is there a nice solution to this issue? I know how to do it with a single for loop.
Thanks
