MATLAB: How to reshape/permute array correctly

permutereshape

I cannot seem to apply the examples in the 'reshape' documentation and/or the answers given in this forum to this many dimensions.
I have an array of 1440x2x8x703x2 and wish to combine the 1440 and 703 dimensions so that I have: 1012320x2x8x2 instead. Should I use a loop or reshape/permute for this? If someone could explain how to use the latter, I would greatly appreciate it, as the documentation is rather confusing!

Best Answer

E.g.,
x = your array
y = permute(x,[1 4 2 3 5]); % Or permute(x,[4 1 2 3 5]) depending on order that you want
result = reshape(y,1012320,2,8,2);