MATLAB: “Find and Replace” in Matlab Editor

find and replaceMATLABmatlab editor

Hi there,
is there a way to specifically search (and replace) only in code lines or only in commented text?
Thanks

Best Answer

I don't think this is a feature in Matlab's find & replace utility.
You could write your own code to do this though - just open a function as a text file and search for the word you want to replace. If it occurs after a % symbol it is probably a comment if not it is probably code.
The problem would be that many functions working with strings (such as sprintf) also utilise % symbols, so that would require some thought. The Matlab editor can differentiate comments from code though, so there may be some Matlab internal function you could utilise for that.
M.