- Replace ref with syzygy
- Replace mov with ref
- Replace syzygy with mov
replacing two reciprocal words in huge number of scripts
1 次查看(过去 30 天)
显示 更早的评论
I have a huge number of scripts in MATLAB. I need to write a new script that will search text of script files and replace "ref" wherever it finds "mov" and also replaces "mov" wherever it finds "ref". I'm confused as apparently I can't simply write a script that replaces "mov" and "ref" and then replaces "ref" with "mov" .
Any input is much appreciated.
0 个评论
采纳的回答
the cyclist
2012-4-1
Three steps:
For the script itself, you should be able to use the regexprep() command to do the replacement.
2 个评论
Image Analyst
2012-4-1
I'd have your script use questdlg() to show you the line of text you're planning on doing the replacement on and ask the user for confirmation. That way you can make sure you don't replace something you don't want, like if you have the word "move" or "reference" in a comment or something like that.
更多回答(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!