Hello,
I like to match the entries in column 2 of matrix A to the reference numbers of B. I'm going to do that for large data sets. Code like follows does exactly what I want but will be to slow. Is there an intelligent function/way available to do that? Thanks a lot!
A = [2 3 5 7; 23 54 76 86]';
B = [1:7]';
j=1;
for i = 1:7
if B(i,1) == A(j,1) B(i,2) = A(j,2); j = j+1; end
end
result: B =
1 0 2 23 3 54 4 0 5 76 6 0 7 86
Best Answer