How do i replace a string in text file in loop?
3 次查看(过去 30 天)
显示 更早的评论
I need to replace a text in a notepad in loop. In the below attached file(input), the term 'zout' needs to be replace from 'zout = 0, 0.25' to 'zout = 0.25, 0.50'(and execute a bunch of other commands inside the loop) until 'zout= 28, 30'.I have attached the code(SBDRUN1) used for running the input file below.
Thanks in advance
3 个评论
Rik
2018-2-9
Unless you are using ActiveX, you can't replace text inside a file. What you can do is read the file, make the changes you want, and then writing the result to the text file, replacing it in its entirety.
回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Characters and Strings 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!