MATLAB: Efficient reordering of vector

reordervector

I would like to reorder vector as following:
a = [1 2 3 4 5 6 7 8 9 10 11 12]
to
r = [1 5 9 2 6 10 3 7 11 4 8 12]
what would be efficient way of doing so?

Best Answer

reshape( reshape(a, 4, 3).', 1, [])