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.

 采纳的回答

This works:
a=[73 312 135 192 0 122];
b=[2 1 5 4 6 3];
Result = a(b)

2 个评论

Thanks alot Star Strider, its work, that really what I want.
As always, my pleasure.

请先登录,再进行评论。

更多回答(0 个)

类别

帮助中心File Exchange 中查找有关 MATLAB 的更多信息

标签

Community Treasure Hunt

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

Start Hunting!

Translated by