Rearrange 3-dimensional array in 2 dimensions

I have a three-dimensional matrix of sizes: 427x470x48

I want to remake this into a two-dimensional matrix of sizes: 48x200690

This would mean that the old (1, 1, :) would correspond to the new (:, 1)

In addition, the old ones (1,2, :) will correspond to the new ones (:, 2), etc. etc.

thanks

+2
source share
1 answer

make:

new = reshape(permute(old, [3 2 1]), 48, []);

You can also roughly check that they are equal:

numel(intersect(old(1,1,:),new(:,1))) == 48;
+3
source

All Articles