MATLAB: Shift Data to the Right and the Left

circshiftshift

Hi, I want to shift my data stream to the right by 1 and left by 1. It is reading from a csv file. I was thinking about using cir sift but I am not sure if that is the best way.

Best Answer

Since your vector is a column vector, shifting left or right (e.g. with circshift) will result in the exact same vector, while a row vector will not:
>>circshift([1;2;3],1,2)
ans =
1
2
3
>>circshift([1,2,3],1,2)
ans =
3 1 2
Read the doc for circshift to understand what it does. (and it is always easier to understand a function when you enter small inputs)