Hi again,
I have two matrices, A and B. A is failure times and B is censoring (all 0s and 1s). I need to sort the failure times (A) from smallest to largest but I need to keep the parts that are censored corresponding.
I need to sort both matrices with the exact same shift so all pieces stay connected and they get sorted smallest to largest.
For example, if I had:
A = [3, 5, 2, 7, 8; 2, 3, 7, 3, 4; 7, 3, 2, 6, 2];B = [1, 0, 1, 1, 0; 1, 1, 1, 0, 1; 0, 1, 1, 0, 1];sort(A) = [2, 3, 2, 3, 2; 3, 3, 2, 6, 4; 7, 5, 7, 7, 8]; %sorted by columns
and I need then,
B = [1, 1, 1, 0, 1; 1, 1, 1, 0, 1; 0, 0, 1, 1, 0]; %corresponding to the right censoring/failing category for sort(A)
I then need help making a new vector, C, which would rank sort(A) like this:
A = [3, 5, 2, 7, 8; 2, 3, 7, 3, 4; 7, 3, 2, 6, 2];C = [1, 1, 1, 1, 1; 2, 2, 2, 2, 2; 3, 3, 3, 3, 3];
(just label the smallest as 1, the second smallest as 2, …, the largest as n (where n is the total number of units in A).
Can someone help?
Best Answer