I want to use circshift until a certain value in my vector until it reaches the end of the array.
5 次查看(过去 30 天)
显示 更早的评论
I have the following vector
front_pos = 17800;
rear_pos = 58400;
B = [0 0 0 0 rear_pos 0 front_pos 0 0 0 0 0 0 0 0 0 0 0 0 0 0]';
I want to continue to circularly shift the until the front_pos variable reaches the last element in the vector
0 个评论
回答(1 个)
KALYAN ACHARJYA
2021-3-15
编辑:KALYAN ACHARJYA
2021-3-15
front_pos = 17800;
rear_pos = 58400;
B = [0 0 0 0 rear_pos 0 front_pos 0 0 0 0 0 0 0 0 0 0 0 0 0 0]';
while B(end)~=front_pos
B=circshift(B,1)
end
B
0 个评论
另请参阅
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!