フィルターのクリア

Shift Data to the Right and the Left

9 ビュー (過去 30 日間)
Sue MM
Sue MM 2018 年 7 月 12 日
回答済み: Rik 2018 年 7 月 12 日
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.
  2 件のコメント
Guillaume
Guillaume 2018 年 7 月 12 日
Depends on what you mean by shifting my data. Can you give a numerical example of input/output
Sue MM
Sue MM 2018 年 7 月 12 日
Sure, I have a [1 x 1000]double for inputted output with values and I want to test out the way that the rest of the code interacts by shift the said input, outputs to the right and to the left

サインインしてコメントする。

採用された回答

Rik
Rik 2018 年 7 月 12 日
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)

その他の回答 (0 件)

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by