MATLAB: How can find a same values in another matrix and copy the row

columncopyduplicaterows

I have two matrix with different number of colums and rows, the first 5×3 and the second 5×6:
%
A = [71.38,25.89,2.72;71.38,25.89,2.72;70.16,28.28,1.54;70.16,28.28,1.54;70.13,26.78,3.08;];
B = [76.34,21.19,2.46,1.31,0.50,1.87;73.73,23.52,2.73,1.450,0.45,1.74;71.38,25.89,2.72,1.07,0.59,1.04;70.16,28.28,1.54,1.42,0.46,1.86;70.13,26.78,3.08,1.25,0.52,2.68;];
I want obtain a matrix C (5×9):
C =[71.38,25.89,2.72,71.38,25.890,2.72,1.07,0.59,1.04;71.380,25.89,2.72,71.38,25.890,2.72,1.07,0.59,1.04;70.16,28.28,1.540,70.16,28.28,1.54,1.42,0.46,1.86;70.16,28.28,1.54,70.16,28.28,1.54,1.42,0.46,1.86;70.13,26.78,3.08,70.13,26.78,3.08,1.25,0.52,2.68;];
In particular I searching for a script that: 1. compare each value of the first column of A and find the same value along the first column of B; 2. copy on the right of each row of A the relative row of B (relative=point 1, have the same value in the first column).
I tried with some logical scrip but they allowed me to copy the values when the same values on both matrix are in the same row. Moreover, I had some problems with reapeted numbers. Thanks in advance for your help.

Best Answer

ind = arrayfun(@(y) find(B(:,1)==y),A(:,1))
CC = [A B(ind,:)]