How can I rearrange an array based on the order indicated by another array?

4 次查看(过去 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, ...)

采纳的回答

Askic V
Askic V 2023-2-17
移动:Fangjun Jiang 2023-2-17
A(Order)

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Matrices and Arrays 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by