> auto data = [1,2,3]; > assert( data.cycle.rotate(2) == [3,1,2] ); > assert( data.cycle.rotate(-2) == [2,3,1] ); It's not of immediate help, but it might trigger other answers. Matlab offers this for multi-dimensional arrays: http://www.mathworks.nl/help/matlab/ref/circshift.html