MATLAB Combine matrices of different dimensions, filling values of corresponding indices
问题 I have two matrices, 22007x3 and 352x2 . The first column in each is an index, most (but not all) of which are shared (i.e. x1 contains indices that aren't in x2). I would like to combine the two matrices into a 22007x4 matrix, such that column 4 is filled in with the values that correspond to particular indices in both original matrices. For example: x1 = 1 1 5 1 2 4 1 3 5 2 1 1 2 2 1 2 3 2 x2 = 1 15.5 2 -5.6 becomes x3 = 1 1 5 15.5 1 2 4 15.5 1 3 5 15.5 2 1 1 -5.6 2 2 1 -5.6 2 3 2 -5.6 I've