Find Files
Simple Search for File Names
If you know the name of the file you want to find, begin typing the first characters of the name in the Current Folder browser. As you type, the Current Folder browser searches downward from the top of the window, looking through all expanded folders. To open the Current Folder browser if it is not open, on the Home tab, in the Environment section, click Layout. Then, under Show, select Current Folder.
Alternatively, to search for a series of characters anywhere in the name of a file:
Click the search button in the Current Folder toolbar. The address bar becomes a search field.
Type a portion of a file name. The asterisk character
(*)
is a wildcard. For example, to show only file names that begin withcoll
and have a.m
extension, typecoll*.m
.Press Enter.
MATLAB® displays all files within the current folder (including its subfolders) that match that file name. If you typed the full path to a folder, that folder becomes the current folder.
To clear the results and show all items in the current folder, press the Esc key.
In MATLAB Online™, to search for files in the current folder or in the current project, go to the Home tab and click the Go to File button.
Advanced Search for Files
To perform an advanced search for files, you can use the Find Files tool. Use the Find Files tool to:
Search for specific text in file names and within files
Include or exclude specified file types from your search
Search in specified folders
Exclude large files from your search
To open the Find Files tool, on the Home tab, in the File section, click Find Files. Enter your search criteria in the dialog box that opens.
Use the Look in menu to specify the folders you want to
search. Select Entire MATLAB Path to search all folders
on the MATLAB search path. Alternatively, you can browse for a folder by selecting
Browse... or you can enter the full path for one or
more folders. Separate each path with a semicolon (;
).
Click Find to begin the search. Search results appear in the right pane of the dialog box, with a summary at the bottom. For text searches, results include the line number and line of code. To see file locations, select Show full path names.
Open one or more files by right-clicking the files and selecting one of the Open options.
Include or Exclude File Types
You can search for files with only a specified extension, by selecting an option in the Include only file type(s) menu. For example, select *.m, *.mlx to limit the search to MATLAB program files.
To exclude some file types from the search:
In the Include only file type(s) menu, select All files (*).
Under More options, select the Skip file type(s) box and click Edit. The Edit Skipped File Extensions dialog box opens.
Select the State check box for the file types to exclude from your search.
Click OK to accept your changes.
You can remove any file extension from the list by selecting the extension to highlight it. Then, click Remove.
Search Within File
Under More options, you can choose to search file contents for a partial word. From the Search type menu, select Contains text. To find an exact full-word match, select Matches whole word.
Searching within large files can be time consuming. To speed up your search, specify a file size in the Skip files over field. The Find Files tool ignores files larger than the size you specify.
Troubleshooting
If the Find Files tool does not find the file you want, try the following:
When searching for file names, use the asterisk character (
*
) as a wildcard character to expand your search. For example, to show file names that begin withcoll
and have a.m
extension, typecoll*.m
.Select the Include Subfolders check box if the file might be in a subfolder.
If you select the Skip file type(s) check box, ensure that you do not exclude relevant file types from your search. Click Edit and review the Edit Skipped File Extensions dialog box. Ensure that relevant file types do not have the State check box selected.
Advanced Search in MATLAB Online
In MATLAB Online, you can search for and replace text in filenames and file content using the Find Files panel. To open the Find Files panel, click the Find Files icon in the sidebar. If the Find Files icon is not in the left or right sidebar, go to the Home tab, and in the File section, click Find Files.
To change how the Find Files tool searches for text, select a search option:
Match case – Search only for text with the precise case of the search text.
Match whole word – Search only for exact full-word matches.
Filters – Specify whether to search for file names or file content, what folders to search in, and what file types to include in the results.
To replace text in filenames and file content, click the expand button
to the left of the search field to open the
replace options. Then, to replace an instance of the search text in the results,
select the line containing the result, enter the text that you want to replace the
search text with, and click the Replace button. To replace
all instances of the search text, click the Replace All
button. Replacing text is supported in text files (.txt
) and
MATLAB code files (.m
).
After performing a search, you can collapse or clear the list of search results,
and export the results as plain text. To collapse or clear the list of search
results, click the Find Files actions button () at the top of the Find Files panel and select
Collapse Results or Clear
Results. To export the list of search results as a plain text file
(.txt
) that can be viewed in an external text editor, click
the Find Files actions button () and select Export as Plain
Text.