File Exchange

image thumbnail


version (2.4 KB) by Jesse Hopkins
Convenient way to open windows explorer.

1 Download

Updated 06 Nov 2009

View Version History

View License

% explore
% opens explorer window to current file open in matlab editor. (if
% no file is open, then the current explorer window at current directory
% will be explored
% explore(file)
% opens explorer window to directory containing "file". This input
% can be a full-file-path, m-function name, or model name.
% explore(dir)
% opens explorer window to specified direcotry "dir". This input can
% be a full-path, relative-path, or just the name of any directory
% on the matlab path. Will open the first folder on the matlab-path
% matching the specified name.
% NOTE: You may change the executable called by explore.m. The default is
% "explorer". To change, use
% explore SetExplorerCommand <command>
% For example, to use UltraExplorer:
% explore SetExplorerComand 'UltraExplorer /p'
% Note that the path containing UltraExplorer.exe must be included
% in your Windows path environment variable.
% This setting is stored as a persistent variable, and will not be
% remembered between Matlab sessions, so this line should reside in
% your startup.m file to permanently change your explorer preference.

Cite As

Jesse Hopkins (2020). Explore (, MATLAB Central File Exchange. Retrieved .

Comments and Ratings (7)


Matthew Arthington

Good script. I've got a less functional script that opens the current editor file's directory using

eval(['!explorer /e,' fileparts(com.mathworks.mlservices.MLEditorServices.builtinGetActiveDocument.toCharArray')]);

Matthew Arthington

Jesse Hopkins

Eric, the point of this script is so that you don't have to type a full path-name to the explorer command. For example, say you have a m-file called my_func.m in some location on your matlab path. If you want to open an explorer window, you can simply type 'explore my_func'. Otherwise you would have to type !explorer c:\path\to\my_func.


Or just use the built in explorer command in DOS along with the ! functionality. Try from the command line:

!explorer (Will open explorer window at top level of windows directory)

!explorer . (Will open explorer window in PWD)

!explorer c:/temp (Will open explorer window at specific address)

Steen Johansen

Does not seem to work in 2007R:

>> explore
??? No appropriate method or public field builtinGetActiveDocument for class com.mathworks.mlservices.MLEditorServices.

Error in ==> explore at 45
string = char(com.mathworks.mlservices.MLEditorServices.builtinGetActiveDocument);

Stead Kiger

See also "Explorer Toolbar Shortcut"

MATLAB Release Compatibility
Created with R2007b
Compatible with any release
Platform Compatibility
Windows macOS Linux

Community Treasure Hunt

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

Start Hunting!