MATLAB: Relocating entire blocks of matrix without using loop

loop-freerearranging arrays

Without using a "for" loop I need to relocate entire blocks of a matrix in the following manner:
This means vertically rearranging blocks that are placed horizontally next to each other, thereby creating a matrix with new dimensions, but the same number of elements.

Best Answer

M = [M(:,1:n);M(:,n+1:2*n);M(:,2*n+1:3*n)];