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,IA0,IC0]=unique(A)
[Cr,IAr,ICr]=unique(A,'rows')
[Cf,IAf,ICf]=unique(A,'first')
In 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 IA0 and IC0 . I just know the relation that C=A(IA0) and A=C(IC0) . Are these 2 output created only to satisfy this two relation? So why should I be intersted in their outputs?
In 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 Cr output"
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 Cr ...
But I still don't understand the output ICr
In 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?
