I need to order a list that is dependant on another list. how to change both lists?
- by Ben Fossen
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 693.
The two lists are on equal length and the first element in list x is related to the first element in list aspl. I need to graph the two lists but want list aspl to be in order from smallest to largest. How would I go about doing this? If I need to move the first element in aspl to position 4 in the list, then the first element of list x also needs to be moved to position 4 in list x. The numbers above are not important they are just examples, the actual program generates hundereds of numbers.
for example x = 6.1692 8.1863 5.8092 8.2754 initially
aspl = 680 637 669 599 693
after changing aspl to ascending order this is how x should look.
x = 5.8092 8.1863 5.8092 6.1692 8.2754
aspl = 599 637 669 680 693