I would want to know a way to find the rows having the same value in the first column (id), and combine those rows together.
Suppose I have the matrix A;
A = [1 2 3 4; 1 5 6 0; 2 2 3 4; 2 5 6 0; 2 6 7 8; 3 1 2 3; 4 1 2 3]
What I want to do is to find the rows with same ids (1st column), and merge their features (other columns). In this case, I need the following matrix.
A = [1 2 3 4 5 6 0 0; 2 2 3 4 5 6 7 8; 3 1 2 3 0 0 0 0; 4 1 2 3 0 0 0 0];
Best Answer