FUNCTION REFERENCE
exist
Check for a variable, file or folder.
Check for a variable, file or folder.
Syntax
n = exist(name)Syntax
n = exist(name, 'var' | 'file' | 'dir' | 'builtin')Returns 1 for a variable, 2 for a file, 7 for a folder, 5 for a built-in function
and 0 when there is none. A name is looked up as variable, then file, then built-in.
Example
x = 5; exist('x') % 1Differences from MATLAB: most functions MatRust provides report 5 (including
some that are M-files in MATLAB, such as `mean`), while functions treated as
program files (`rms`, `isoutlier`, `filloutliers`, `rmoutliers`,
`detectImportOptions`, `setvartype`, `getvaropts`, `setvaropts`, `preview`,
`readtimetable`) report 2 and `exist(name, 'builtin')` returns 0.
These are the engine’s help pages. Each page keeps its compatibility notes. File operations are unavailable in the browser.