I need to order a list that is dependant on another list. how to change both lists?

前端 未结 1 2007
迷失自我
迷失自我 2021-01-20 00:01

I have a Matlab program that generates a list x = 6.1692 8.1863 5.8092 8.2754 6.0891 the program also outputs another list aspl = 680 637 669 599 69

相关标签:
1条回答
  • 2021-01-20 00:03

    Use the second output of sort:

    %# sort aspl, get new order of aspl
    [sortedAspl, sortOrder] = sort(aspl);
    %# reorder x the same way as aspl
    sortedX = x(sortOrder);
    
    0 讨论(0)
提交回复
热议问题