Merging the matched rows of two matrices/files
2 views (last 30 days)
Show older comments
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
See Also
Categories
Find more on Resizing and Reshaping Matrices in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!