Azzera filtri
Azzera filtri

how to cyclically shift an array?

1 visualizzazione (ultimi 30 giorni)
bsd il 11 Dic 2011
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.

Risposta accettata

Walter Roberson
Walter Roberson il 11 Dic 2011

Più risposte (1)

Mohsen  Davarynejad
Mohsen Davarynejad il 11 Dic 2011
x = [1 : 1 : 10]
for i = 1 : 5
x = [x(2:end) x(1)]
  1 Commento
Jan il 11 Dic 2011
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]".

Accedi per commentare.


Scopri di più su Multidimensional Arrays in Help Center e File Exchange


Community Treasure Hunt

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

Start Hunting!

Translated by