MATLAB: How to rearrange rows in specific intervals

MATLABmatrix manipulation

I have a matrix like so:
[x1 y1 z1;
x2 y2 z2;
x3 y3 z3;
x1 y1 z1;
x2 y2 z2;
x3 y3 z3;
x1 y1 z1;
x2 y2 z2;
x3 y3 z3]
Is there a non-loop solution to reorder the matrix to:
[x1 y1 z1;
x1 y1 z1;
x1 y1 z1;
x2 y2 z2;
x2 y2 z2;
x2 y2 z2;
x3 y3 z3;
x3 y3 z3;
x3 y3 z3]
In other words get every third column (in this case) and set them in order. The final matrix would end up being the same size.
I appreciate any help possible.

Best Answer

I use the Symbolic Math Toolbox to illustrate the approach and the desired result:
syms x1 y1 z1 x2 y2 z2 x3 y3 z3 real
M = [x1 y1 z1;
x2 y2 z2;
x3 y3 z3;
x1 y1 z1;
x2 y2 z2;
x3 y3 z3;
x1 y1 z1;
x2 y2 z2;
x3 y3 z3];
A = reshape(M, 3, 3, []);
B = permute(A, [3 2 1]);
Result = reshape(B, 3, [])'
Result =
[ x1, y1, z1]
[ x1, y1, z1]
[ x1, y1, z1]
[ x2, y2, z2]
[ x2, y2, z2]
[ x2, y2, z2]
[ x3, y3, z3]
[ x3, y3, z3]
[ x3, y3, z3]