exist
Check whether a name exists in the workspace, on disk, or as a built-in.
Syntax
Section titled “Syntax”tf = exist(name)tf = exist(name, kind)Description
Section titled “Description”Returns an integer code indicating what (if anything) the name name refers to:
0— does not exist1— workspace variable2— file (script or data file) on the path5— built-in MATLAB function7— directory on the path8— class
With the optional kind argument ('var', 'file', 'class', 'builtin', 'dir'), restricts the search to that one type.
Examples
Section titled “Examples”exist('x') % 1 if x is a workspace variableexist('plot', 'builtin') % 5