Locate functions and files
which
displays
the full path for item
item
.
If item
is a MATLAB® function in a MATLAB code file (.m
,.mlx
,
or .p
extension), or a saved Simulink® model (.slx
or .mdl
extension), then which
displays the full path for the
corresponding file. item
must be on the MATLAB path.
If item
is a method in a loaded Java® class,
then which
displays the package, class, and method
name for that method.
If item
is a workspace variable,
then which
displays a message identifying item
as
a variable.
If item
is an unsaved Simulink model that is loaded in Simulink, then which
displays a message
identifying item
as a new Simulink model.
If item
is a file name including
the extension, and it is in the current working folder or on the MATLAB path,
then which
displays the full path of item
.
If item
is an overloaded function or method,
then which
item
returns only
the path of the first function or method found.
which ___ -all
displays the paths to all
items on the MATLAB path with the requested name, as well as any files in special
folders that have been implicitly added to the path. Such items include methods
of instantiated classes. For more information about these special folders, see
What Is the MATLAB Search Path. You
can use -all
with the input arguments of any of the previous
syntaxes.
When the class is not loaded, which
only
finds methods if they are defined in separate files in an @-folder
and are not in any packages.
For more information about how MATLAB uses scope and precedence when calling a function, see Function Precedence Order.