I have a matrix D which is a concatenation of 4 matrices of 3 rows (breaks added for clarity). I would like to construct a matrix C reporting the unique rows within the total matrix D listed for each of the sub-matrices of D with a count of how many times they occur.
D=[1 0 1 1; 0 1 1 1; 1 1 0 1; -------- 1 1 0 1; 1 1 0 1; 0 1 1 1; -------- 1 1 1 0; 0 1 1 1; 1 0 1 1; -------- 1 0 1 1; 1 0 1 1; 1 1 0 0]
So for the above matrix, there are 5 unique rows:
1 0 1 1 0 1 1 1 1 1 0 1 1 1 1 0 1 1 0 0
So breaking those 5 rows into the 4 sub-matrices with counts of occurrence within them it would be:
C=[1 0 1 1 1; 0 1 1 1 1; 1 1 0 1 1; 1 1 1 0 0; 1 1 0 0 0; -------- 1 0 1 1 0; 0 1 1 1 1; 1 1 0 1 2; 1 1 1 0 0; 1 1 0 0 0; ---------- 1 0 1 1 1; 0 1 1 1 1; 1 1 0 1 0; 1 1 1 0 1; 1 1 0 0 0; ---------- 1 0 1 1 2; 0 1 1 1 0; 1 1 0 1 0; 1 1 1 0 0; 1 1 0 0 1]
Best Answer