How can I rearrange an array based on the order indicated by another array?
조회 수: 7 (최근 30일)
이전 댓글 표시
Ex:
Order = [8, 19, 1, 13, 4, 14, 11, 2, 15, 12, 17, 3, 7, 12, 6, 11, 7, 19, 13, 15, 2, 18, 9, 1, 20, 10, 3, 16, 8, 20, 5, 16, 9, 6, 17, 10, 5, 14, 4, 18];
A = [1.1, 1.35, 2.15, 2.25, 2.25, 2.35, 1.85, 1.35, 1.2, 1.05, 1, 1.1, 0.7, 0.7, 0.95, 0.6, 0.8, 1.2, 1.6, 1.05];
I want to rearrange A/create a new array according to the order specified in array "Order" (i.e, pick the 8th value of A, then the 19th, ...)
댓글 수: 0
채택된 답변
추가 답변 (0개)
참고 항목
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!