Move elements of a vector to the rigth.

1 visualización (últimos 30 días)
Julen Vicente Pipaon
Julen Vicente Pipaon el 27 de Mzo. de 2021
Comentada: Julen Vicente Pipaon el 27 de Mzo. de 2021
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 ]

Respuesta aceptada

DGM
DGM el 27 de Mzo. de 2021
Try this:
a=[1 2 3 4 5]
b=circshift(a,[0 1])

Más respuestas (0)

Etiquetas

Community Treasure Hunt

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

Start Hunting!

Translated by