How can I find and replace strings in a text file?
Show older comments
Hi,
I've written my table to a text file; however, I need this text file to be delimited by three spaces, which MATLAB doesn't allow using the 'writetable' function. Therefore, I must find and replace each instance of the ' ' string with the ' ' string in my text file. I also need to replace the first line of my text file with another string. How can I accomplish this?
I've tried to use textscan for this, but I keep getting the following error:

For visual clarity, here is what I am trying to accomplish with my text file:
(original)
(goal)Accepted Answer
More Answers (0)
Categories
Find more on Characters and Strings in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!