Could you please separate the code and filetext from the question statements? It's a bit difficult to understand with everything mixed together.
How to add rows at a specific location
1 次查看(过去 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
回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Text Analytics Toolbox 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!