Using "Find and Replace Text in Files" to add new line in m-file
10 views (last 30 days)
Show older comments
I have an m-file in which one line looks like this:
String1_String2_String3
I want to use "Find and replace in Text Files" (by pressing ctrl+F) to replace the underscore with a new line so that my m-file looks like this:
String1
String2
String3
What do I have to put in the "Replace with:" field in the gui?

In excel for example I can just put in "Ctrl+j" for this task. Is there a way to do the same in Matlab without running a script (descriped in other question to the topic)?
2 Comments
Rik
on 18 Dec 2020
I'm not aware of this being possible. But why do you want to do this without running a script? It is very easy to do this with a script.
Answers (1)
Cris LaPierre
on 18 Dec 2020
I don't believe this is possible in the MATLAB editor. However, googling showed it is possible in some text editors (Notepad++ for example).
My suggestion would be to open your m-file in one of those editors, make the change there, then return to MATLAB.
See Also
Categories
Find more on Desktop 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!