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, ...)
0 个评论
采纳的回答
更多回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Matrices and Arrays 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!