How to add rows at a specific location
조회 수: 2 (최근 30일)
이전 댓글 표시
I have a text file like this
1 2 0
30 0.7646 0.150 0.400 0.350 0.600 1.000 0.000
34 0.2354 0.150 0.000 0.350 0.000 1.000 0.000
79 79 79 10 10 10 12 12 10 10 10 10
1 2 1
30 0.7646 0.150 0.400 0.350 0.600 1.000 0.000
34 0.2354 0.150 0.000 0.350 0.000 1.000 0.000
79 79 79 10 10 10 12 12 10 10 10 10
I have a second text file like this
30
31
32
My question is
if the value of first text file matches with value of first column of secong text file then in fist text file where first row third column is 1 (1 2 1) there the line 30 0.7646 0.150 0.400 0.350 0.600 1.000 0.000(because 30 is matching) will add before the last line like 79 79 79 10 10 10 12 12 10 10 10 10
The final text file will be
1 2 0
30 0.7646 0.150 0.400 0.350 0.600 1.000 0.000
34 0.2354 0.150 0.000 0.350 0.000 1.000 0.000
79 79 79 10 10 10 12 12 10 10 10 10
1 2 1
30 0.7646 0.150 0.400 0.350 0.600 1.000 0.000
34 0.2354 0.150 0.000 0.350 0.000 1.000 0.000
30 0.7646 0.150 0.400 0.350 0.600 1.000 0.000
79 79 79 10 10 10 12 12 10 10 10 10
댓글 수: 1
Nobel Mondal
2015년 5월 21일
Could you please separate the code and filetext from the question statements? It's a bit difficult to understand with everything mixed together.
답변 (0개)
참고 항목
카테고리
Help Center 및 File Exchange에서 Standard File Formats에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!