Registered Member
|
I am currently porting some matlab code to C++ and trying to use the Eigen library.I want to know how to transfer this block of code into c++? It's purpose is to find a value which is in A(:,3) according to B(:,1:2) whose two data is equal to A(:,1:2).
row= 1:n [~,ia,ib] = intersect(A(:,1:2),B(:,1:2),'rows'); B(ib,row) = A(ia,3); for example: A<<1,2,3 4,5,6 7,8,9 B<<7,8, 4,5, the result is B = 7,8,9 4,5,6 |
Moderator
|
I'm afraid there is no helper for that ask. You can compare rows as A.row(i)==B.row(j) and copy rows in a similar way, but you will have to do the rest by yourself.
|
Registered users: bartoloni, Bing [Bot], Evergrowing, Google [Bot], ourcraft