I have two arrays, A & B. The first digit of each row is the serial number.
A = [ 12345; 47542; 32673; 65436; 75343; 23496; 54765]B = [23566; 33425; 65438; 75354]
How do I combine A and B to have an array C, such that all rows in A with the same serial number in B are concatenated horizontally.
C should be:
C = [12345, 00000;
47542, 00000;
32673, 33425;
65436, 00000;
75343, 75354
23496, 23566;
54765, 00000]
After sorting based on the first row, we have:
C = [12345, 00000; 23496, 23566; 32673, 33425; 47542, 00000; 54765, 00000; 65436, 00000; 75343, 75354]
i tried
y=ismember(A(:,1), B(:,1), 'rows'); t=find(y); C= [A(t,1:12),B(t,1:12)];
But got an error message
Best Answer