The question is to rank the element of each vector (column) in A(n,n) according to the order in B(m,n) and get a new matrix with these ranks. It is a classification of elements by column : example:
A = [0 4 7 ; 1 3 5 ; 3 3 6 ] B = [0 0 1 ; 3 1 2 ]
A(1,1)<=B(1,1)==>C(1,1)=1<—the index of zero in B;
A(2,1)>B(1,1)=0 && A(2,1)<=B(2,1) ==> C(2,1)=2
A(3,1)==B(2,1)> B(1,1)=0 ==> C(3,1)=2 and go next to the second column, then next one to get
C=[1 2 2, C(:,2),C(:,3)]
Best Answer