image thumbnail


version (3.76 KB) by Brett Shoelson
Returns the names of all m-files within the specified path containing a specified search string.


Updated 25 Oct 2001

View License

Like the "grep" functionality in the GNU Project, this program searches files for the presence of a search string. However, mfilegrep searches only mfiles. Searches can be recursive or non-recursive, and case-sensitive or non-case-sensitive, and can search for whole words or partial words. The result is returned in a cell array that contains the names of all mfiles on the specified path that contain the search string. Additionally, the user has the option of listing the text of all lines in the mfiles containing the search string.

Cite As

Brett Shoelson (2022). mfilegrep (, MATLAB Central File Exchange. Retrieved .

MATLAB Release Compatibility
Created with R12.1
Compatible with any release
Platform Compatibility
Windows macOS Linux

Inspired: mgrep

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!