Changing order of elements of one vector depending on the order of another vector
이전 댓글 표시
Hi
I have two vectors, say:
a = [0.1 0.4 0.2 0.9 2]
b = [5 10 11 2 4]
I want to order a, such that the vector would start with the smallest element, and finish with the largest, like this:
a = [0.1 0.2 0.4 0.9 2]
Not that now element 2 and 3 of the vector a have been swapped for this purpose. Now I want to somehow swap the elements of b exactly as the elements of a where swapped (so the new b would be b = [5 11 10 2 4]). How can I do that systematically? Many thanks
채택된 답변
추가 답변 (0개)
카테고리
도움말 센터 및 File Exchange에서 Shifting and Sorting Matrices에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!