compare and extract lines from multiple text files

조회 수: 5 (최근 30일)
Muhammad Zafar Iqbal
Muhammad Zafar Iqbal 2020년 1월 13일
댓글: Bob Thompson 2020년 1월 13일
Hi
I have three text files
A.txt
2016-09-12 11:10
2016-09-12 11:45
2016-11-26 21:53
2016-07-05 10:17
2016-17-26 01:53
B.txt
2017-04-28 2:19 1
2
3
2017-06-11 9:16 4
5
6
2016-11-26 21:53 7
8
9
2017-02-24 2:34 10
11
12
2016-07-05 10:17 13
14
15
and
C.txt
36.94 128.91 36.598 128.808 14.4 021920 CHYB 0.2 41.67 21.12 22
0.27581 0.3125 -0.18289 0.01911 -0.164 -0.12759 -0.29785 0.33008 -0.14826 0.03647
36.94 128.91 37.274 129.187 2.1 091653 CHYB 0.3 44.58 79.84 18
-0.15509 -0.33082 0.03158 -0.00179 0.22133 -0.08324 0.27631 0.00557 0.02958
36.22 127.97 36.344 127.336 5.4 215242 CPR2 0.2 58.73 25.78 6
-0.08287 0.03073 -0.02138 0.06548 0.26681 -0.25878
36.22 127.97 36.382 127.798 13.4 023438 CPR2 0.2 27.23 18.26 36
-0.16245 -0.03712 0.19955 -0.2824 -0.20541 -0.08394 0.11936 0.32622 0.29109 0.15924 0.01158
36.22 127.97 35.984 127.979 1.6 101730 CPR2 0.3 26.3 36.47 36
0.01215 -0.1267 -0.30525 -0.1333 0.1172 -0.40318 0.0829 0.132 0.39883 0.12017
First I want to compare A.txt with B.txt
If first two columns compared the I need to extract three rows starting from compared lines (Lines will be like 123, 456,789) column 3 in B.txt is only the line number which may be in different column if the line is blank. Multiple entries may be there in B.txt so, I need to keep it.
  댓글 수: 1
Bob Thompson
Bob Thompson 2020년 1월 13일
I'm not sure I understand all that your trying to do. Here is what I got:
1) Find the row number of dates in A that can be found in B.
2) Use the identified row numbers to get information from those rows in C.
Is this correct?

댓글을 달려면 로그인하십시오.

답변 (0개)

카테고리

Help CenterFile Exchange에서 Entering Commands에 대해 자세히 알아보기

태그

제품


릴리스

R2019b

Community Treasure Hunt

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

Start Hunting!

Translated by