findreplace

This function finds and replaces strings in a text file
13.3K Downloads
Updated 27 Dec 2005

View License

SYNTAX:

findreplace(file,otext,ntext)
findreplace(file,otext,ntext,match)

file: text file name (with or without path)
otext: text to be replaced (old text)
ntext: replacing text (new text)
match: either (1) for match case or (0) to ignore case. Default value is (1)

Example:

findreplace('sample.txt','Moller','Moler');
findreplace('sample.txt','jake','Jack',0);
findreplace('sample.txt','continue it is','continue its',0);

Cite As

Fahad Al Mahmood (2026). findreplace (https://ch.mathworks.com/matlabcentral/fileexchange/9447-findreplace), MATLAB Central File Exchange. Retrieved .

MATLAB Release Compatibility
Created with R14SP3
Compatible with any release
Platform Compatibility
Windows macOS Linux
Categories
Find more on Characters and Strings in Help Center and MATLAB Answers
Version Published Release Notes
1.0.0.0