FUNCTION REFERENCE

which

Locate a function or variable.

Locate a function or variable.

Syntax

s = which(name); c = which(name, '-all'); which name

Returns 'variable' for a workspace variable, the full path of a function file in the current folder or on the search path, built-in (...) for built-in functions and keywords, and '' when nothing is found. Called inside a file, a function in that file's private folder is found first (see addpath); at the Command Window private functions are not found. A package-qualified name (which pkg.fn) gives the file of that package, and a name on the import list gives the package file it stands for (see import).

Example

s = which('zz_nonexistent_fn')   % ''

Differences from MATLAB: Built-in and toolbox locations are reported under the MatRust installation folder; '-all' lists one location.

These are the engine’s help pages. Each page keeps its compatibility notes. File operations are unavailable in the browser.