|
"Jorge " <jorge.ebinger@db.com> wrote in message <iamon0$lrr$1@fred.mathworks.com>...
> Hi,
> I need to find the Index of a matrix that rearranges it like in the following example:
> I have this Vector: A = [5 6 4 4 5 4 5 7];
> and B = sort(A) is equal to: B = [4 4 4 5 5 5 6 7];
> I need to find the Index X so that A = B(X)
> Is there a function for that?
======
Sorry, we all read your post to fast. You want the indexing X that inverts the sort operation.
One way is
[B,idx] = sort(A);
[~,X]=sort(idx);
|