I have browsed in here for answers, but unsuccessful. I have code of the following type:
matrix = [1, 2, 3]';
for start = 1:3
if start == 1
% nothing happens
elseif start == 2
matrix = [matrix(2),matrix(3),matrix(1)]'
elseif start == 3
matrix = [matrix(3),matrix(1),matrix(2)]'
end
end
I would like to change it so that I can use it for vectors that are much longer than the matrix here, so I would like to write it in more general form. (In words, I would like to be able to start at any value in the vector, go through till the end of the vector and from the start again till the value.)
Possibility 1) matrix = [matrix(start:end);matrix(1:start-1)]
Possibility 2) circshift
command