how to cyclically shift an array?
3 ビュー (過去 30 日間)
古いコメントを表示
Hai,
I have an array of elements, I need to shift them cyclically to the left. How could I do it in matlab? Looking forward for your reply.
BSD
0 件のコメント
採用された回答
その他の回答 (1 件)
Mohsen Davarynejad
2011 年 12 月 11 日
x = [1 : 1 : 10]
for i = 1 : 5
x = [x(2:end) x(1)]
end
1 件のコメント
Jan
2011 年 12 月 11 日
The FOR loop might be confusing here. It is useful to demonstate the repeated operation only.
"1:10" is nicer and faster than "[1:1:10]".
参考
カテゴリ
Help Center および File Exchange で Whos についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!