MATLAB: How to index a sorted array with the actual array indexsort How to index a sorted array with the actual array? Best Answer a = rand(20,1);[new,idx] = sort(a); Related SolutionsMATLAB: Rearranging elements in a 2D array RandomArray=sort(RandomArrayI:));If the original sizes are desired, add this:RandomArray = reshape(RandomArray,20,5);If you them ascending to the right and then ascending as you go down, do this instead:RandomArray = reshape(RandomArray,5,20).'; MATLAB: Arrays sorting A = [3 5 11]B = [2 3 0]C = times(A, B);[D, Index] = sort(C);AA = A(Index)BB = B(Index) Related QuestionSorting and indexing multidimensional arraysIndex error with no arrayWho to sort pairs of arrays in the same order one based on the otherIndexing back into an array the same size as one that was just sorted
Best Answer