How to move elements of a vector

3 visualizaciones (últimos 30 días)
cami
cami el 25 de Nov. de 2018
Comentada: cami el 26 de Nov. de 2018
I'd want the code that given the vector A
A=[ 1 2 4 3 0 1 5 3 7 9]
returns
A=[ 1 2 3 4 0 1 3 5 7 9]
thanks
  2 comentarios
Image Analyst
Image Analyst el 25 de Nov. de 2018
There are many possible ways, like using deal(). What is your rule for the new order?
cami
cami el 26 de Nov. de 2018
i want to rebuild the original matrix...
in my case the best way would be using fliplr

Iniciar sesión para comentar.

Respuestas (1)

Matt J
Matt J el 25 de Nov. de 2018
Editada: Matt J el 25 de Nov. de 2018
A([ 3:4:end, 4:4:end]) = A([ 4:4:end, 3:4:end])

Categorías

Más información sobre MATLAB en Help Center y File Exchange.

Etiquetas

Community Treasure Hunt

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

Start Hunting!

Translated by