how to cyclically shift an array?

2 次查看(过去 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

采纳的回答

Walter Roberson
Walter Roberson 2011-12-11

更多回答(1 个)

Mohsen  Davarynejad
Mohsen Davarynejad 2011-12-11
x = [1 : 1 : 10]
for i = 1 : 5
x = [x(2:end) x(1)]
end
  1 个评论
Jan
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 CenterFile Exchange 中查找有关 Multidimensional Arrays 的更多信息

标签

Community Treasure Hunt

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

Start Hunting!

Translated by