How to delete/extract rows of data from file 1 based on what data appears in file 2?
조회 수: 1 (최근 30일)
이전 댓글 표시
Version 2018a. The goal is to remove all unwanted data or to extract just the desired rows.
I've got two sets of data (D1 and D2) that are made up of an equal number of columns. The number of rows of each data set may be different.
The values in the second column vary slightly between both sets. However, if a number in the second column from D1 also appears somewhere in column two from D2, extract both of those rows. Alternatively, delete all rows from D1 and D2 with a value in column two that does not have an equal.
I've made some progress using ismember and intersect, but I'm hitting a wall trying to apply the row indices in a loop. Maybe there's a cleaner way to go about this?
PS: Here's a more advanced question. If a value in col 2 of D1 is within 10% of a value in col 2 of D2, then accept each of those rows to compare. I struggle with this because what if there's a tie for multiple rows. How would you determine a preference?
댓글 수: 0
채택된 답변
추가 답변 (0개)
참고 항목
카테고리
Help Center 및 File Exchange에서 Logical에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!