Merging the matched rows of two matrices/files
Ältere Kommentare anzeigen
I have two sets of data as in the attached files A and B (where length(A)>length(B)).
I need to
(i) Match:
Match the IDs in column 1 then compare the numbers in column 2 of A and B, and identify the rows with relatively closer numbers in column 2.
For instance B(1,:) -->
3000 70.0800000000000 0
and A(2,:) -->
3000 70.0200000000000 2981.87406731008
(ii) Merge:
Follwing to the match in (i), place the element '0' from column 3 of B in a newly created 4th column in A and leave '.' as the place holders in the remaining rows that doesn't have matching column 2 elements with B
For instance in A(1:2, :) ...
3000 69.9400000000000 2982.16721456415 .
3000 70.0200000000000 2981.87406731008 0
Any help to sort this will be highly appreciated.
Thank you
1 Kommentar
KSSV
am 30 Sep. 2020
Read about ismembertol.
Akzeptierte Antwort
Weitere Antworten (1)
Aman Vyas
am 6 Okt. 2020
0 Stimmen
Hi,
You can try to use ismembertol which gives or reports members within some tolerance.
You can have a look at this link:
Also you can utilise other ismember syntax as per the functionality you want to achieve for code.
You can refer to this
Hope it helps !
1 Kommentar
Kategorien
Mehr zu Numerical Integration and Differentiation finden Sie in Hilfe-Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!