I'm studying the function
unique, which looks simple at a first sight but I don't understand some properties.
I created a matrix
A and tried to analyze the outputs:
A=[5 2 4 5;
1 1 3 4;
6 1 2 3]
C0 the logic of the output is "create a vector in which there are values that appears at least one time"
But I don't know the meaning of
IC0. I just know the relation that
A=C(IC0). Are these 2 output created only to satisfy this two relation? So why should I be intersted in their outputs?
Cr ('rows' example) the logic of the output is "give me back the rows of the original matrix
A but sorted ascending. Also, if you find at least two or more rows that repeat with same values and order, show that row only once in
The logic of
IAr is very intuitive: "give me back the index that must follow the
Cr output to order the rows." So in my example gives me back a vector like
IAr=[2;1;3]. Thus the second row of the original matrix
A must be the first in the
Cr output, the first row in
A matrix must be the second in
But I still don't understand the output
Cf ('first' example) gives me back the same output as
C0. And it's not really clear to me how to use properly this function.
Can anyone gives me a simple explanation about how this function works?
Are there any simple practical examples in which I can take advantage of these other outputs?