I have a situation like this
I have data M size (x by 2) where data were in already in classify group by
C = unique(M(:) , 'rows'); %result will be in g-by-2
now I want to assign the data group M accord to C
by creating a R matrix size M-by-1.
Example
M = [ 1 2;
3 3;
1 2;
1 5;
. . ];
assume I got 3 groups
C = [ 1 2;
3 3;
1 5];
I want R to be like
R = [ 1;
2;
1;
3;
. ];
I try to use loop for and find to compare all group
for i = 1:size(C(1)
find(M(:) == C(i,:));
end
but it didn't work