Quickly search all folders and subfolders from your user path for m-files that contain a specific search term.
Updated 13 Apr 2021

View License

We've all been there... you know you wrote some code somewhere which would help you finish your task but you can't quickly remember where. Perhaps you need to update a graph in your thesis that you prepared a year ago and you know the y-axis label, or you want to remember how you applied a particular function in your code a while back.

The codesearch function is a simple way to quickly search all your m-files for a particular search term. The function lists the matching m-files in the Command Window along with hyperlinks for:

(i) opening the m-file in the MATLAB Editor and
(ii) changing the Current Folder to the directory of the matching m-file.

Additional functionality is described in the help text for the codesearch.

Cite As

Turlough Hughes (2024). codesearch (, MATLAB Central File Exchange. Retrieved .

MATLAB Release Compatibility
Created with R2021a
Compatible with R2019b to R2021a
Platform Compatibility
Windows macOS Linux

Community Treasure Hunt

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

Start Hunting!
Version Published Release Notes

Modified codesearch logo (nothing in the actual function).