I want to use circshift until a certain value in my vector until it reaches the end of the array.
3 ビュー (過去 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 件のコメント
参考
カテゴリ
Help Center および File Exchange で Creating and Concatenating Matrices についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!