필터 지우기
필터 지우기

Compare two files and remove any lines in the second file when they match values found in the first file

조회 수: 2 (최근 30일)
Dear all,
I was wondering if there is a way in matlab to compare to files and remove the lines in file2 that match values in file1.
I used in the past visdiff to compare files, but I would like to understand if, using the same function, I can remove the lines that matches between the two files.
Some of you has some ideas to suggest?
Thanks to whoever help me.
Chiara

채택된 답변

Stephen23
Stephen23 2024년 5월 3일
lines1 = [1,2,3,4;2,4,6,7;2,5,7,8;6,7,4,6]
lines1 = 4x4
1 2 3 4 2 4 6 7 2 5 7 8 6 7 4 6
<mw-icon class=""></mw-icon>
<mw-icon class=""></mw-icon>
lines2 = [2,4,6,7;2,5,7,8]
lines2 = 2x4
2 4 6 7 2 5 7 8
<mw-icon class=""></mw-icon>
<mw-icon class=""></mw-icon>
out = setdiff(lines1,lines2,'rows')
out = 2x4
1 2 3 4 6 7 4 6
<mw-icon class=""></mw-icon>
<mw-icon class=""></mw-icon>

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 File Operations에 대해 자세히 알아보기

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by