Reputation:
How to sort a list and get the initial index of a value in matlab.
e.g
orignal A=[40;30;20;50;60]
sorted A=[20;30;40;50;60]
indices of sorted A in orignal A =[3;2;1;4;5]
Upvotes: 1
Views: 64
Reputation: 20915
You can use the second output:
[~,i]=sort([40;30;20;50;60])
The tilda means that the first output is ignored.
Upvotes: 0