exist

Check for the existence.

Syntax

  • res = exist(name)

  • res = exist(name, category)

Input argument

  • name - a string: name of variable, function, file or directory.

  • category - a string: 'var', 'builtin', 'file', or 'dir'.

Output argument

  • res - a integer value.

Description

exists checks for the existence of variable, builtin, file or directory.

exists returns:

0 does not exist

1 is an variable

2 is a file

3 is a mex function

5 is a builtin or function

7 is a directory

Example

exist('fileread')
fileread = 3;
exist('fileread')
clear fileread
exist('fileread')

See also

isbuiltin, ismacro, isfile, isdir, isvar.

History

Version
Description

1.0.0

initial version

Author

Allan CORNET

Last updated