Find a specific word in a textfile and insert 2 new lines in front of it
1 次查看(过去 30 天)
显示 更早的评论
Hello,
I've got a very basic question which I can't seem to figure out. I've got a textfile in which I want to find the word 'Observation_3'. Then I want to insert 2 new lines in front of the word 'Observation_3'. Can anyone help?
Thank you.
4 个评论
Rik
2020-8-6
insterttext=sprintf('%s\n%\s\n','hello','world');
newfiletext = [filetext(1:(endIndex-14)) insterttext filetext((endIndex-13):end)];
回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Low-Level File I/O 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!