Hi Vincent, You can use sortperm <http://docs.julialang.org/en/release-0.3/stdlib/sort/#Base.sortperm>.
So, a = [ 20; 10; 30] sorted_inds = sortperm(a) # a = [2; 1; 3] sorted_arr = a[sorted_inds] # or simply sorted_arr = sort(a) Hope that helps. Best, Pulkit On Thu, Jul 2, 2015 at 9:25 AM, vincent leclere <[email protected]> wrote: > Hello, > > I couldn't find an easy way to sort an array and have the corresponding > indexes > of the original array. > > An example of what I want : > [array_sorted, Indexes] = sort ( [20 10 30]) > giving > array_sorted = [10 20 30] > Indexes = [2 1 3] > > any help welcomed > -- Pulkit
