MATLAB: How to “restart” a matrix from an especific element

matrixrestartsquare

Hi everyone. I have a square matrix like this: [1,2,3;4,5,6;7,8,9]
How could I restart the sequence from an especific element? For example, I want to restart the sequence from 4, so the matrix will be: [1,2,3;4,1,2;3,4,5]
Thanks a lot!

Best Answer

restart_after := 4;
Matrix(restart_after+1:end) = Matrix(1:end-restart_after);
Related Question