I have been trying to achieve this behavior using reshape. I'm new to matlab so I've been struggling a bit.
I have a
3 x 2 x 5 matrix called A
And I would like to merge dimensions 1 through 5, excluding 4. When combining them I want to retain the columns within each row in order.
I know I can do something like
A = reshape(A, [12, 2, 1]) but my concerns are this may not retain the order of the columns within each row and it doesn't allow me to exclude a dimension.
Example:
(:,:,1) =
0.3168 3.1825
1.5841 1.5766
-0.7892 3.0073
(:,:,2) =
-0.2131 3.9708
2.9435 0.4964
-0.2131 2.5985
(:,:,3) =
0.5012 -3.5328
0.4551 2.1314
-1.5956 3.4161
(:,:,4) =
-0.12 -3.28
-0.51 -2.14
-1.56 -3.61
(:,:,5) =
6.5012 3.538
0.4551 0.314
-0.5956 0.411
Output, let's say of combining all dimension except the 4th one
0.3168 3.1825
1.5841 1.5766
-0.7892 3.0073
-0.2131 3.9708
2.9435 0.4964
-0.2131 2.5985
0.5012 -3.5328
0.4551 2.1314
-1.5956 3.4161
6.5012 3.538
0.4551 0.314
-0.5956 0.411