change position values between two vectors

Dear all; I have two vectors as seen below , and I want change position between them depend on vector b. The results should be: a=[73 312 135 192 0 122]; b=[2 1 5 4 6 3];
result=[ 312 73 0 192 122 135];
I tried result(b) = a; % and not work.
please help and Thanks in advance.

 Respuesta aceptada

Star Strider
Star Strider el 25 de Dic. de 2016
This works:
a=[73 312 135 192 0 122];
b=[2 1 5 4 6 3];
Result = a(b)

2 comentarios

skysky2000
skysky2000 el 25 de Dic. de 2016
Thanks alot Star Strider, its work, that really what I want.
Star Strider
Star Strider el 25 de Dic. de 2016
As always, my pleasure.

Iniciar sesión para comentar.

Más respuestas (0)

Categorías

Más información sobre MATLAB en Centro de ayuda y File Exchange.

Etiquetas

Preguntada:

el 25 de Dic. de 2016

Comentada:

el 25 de Dic. de 2016

Community Treasure Hunt

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

Start Hunting!

Translated by