Move elements of a vector to the rigth.

조회 수: 1 (최근 30일)
Julen Vicente Pipaon
Julen Vicente Pipaon 2021년 3월 27일
댓글: Julen Vicente Pipaon 2021년 3월 27일
Hi.
I want to know how I move all the elements of a vector to the rigth.
For example:
[0 0 0 1 0 0] =====> [0 0 0 0 1 0]
or
[ 1 2 3 4 5] =====> [ 5 1 2 3 4 ]

채택된 답변

DGM
DGM 2021년 3월 27일
Try this:
a=[1 2 3 4 5]
b=circshift(a,[0 1])

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Subplots에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by