exist
Returns an integer (R) based on whether a variable, function, directory, or file with the name s exists in the current session.
Syntax
R = exist(s)
R = exist(s, category)
Inputs
- s
 - Type: string
 
- opt (optional)
 - Input specifying the category which will be searched for the existence of
              s. Valid values are:
- 'var'
 - Searches for variables.
 
- 'builtin'
 - Searches only for functions.
 
- 'dir'
 - Searches for directories on disk.
 
- 'file'
 - Searches for files on disk.
 
 
Outputs
- R
 - The value of R is one of the following: 
- 0
 - s does not exist
 
- 1
 - s is a data variable
 
- 2
 - s is a file in the current directory or search path
 
- 5
 - s is a built-in function
 
- 7
 - s is a directory in the current directory or search path
 - 103
 - s is a function.
 
 
Examples
function myfunc()
    disp('In myfunc')
end
R = exist('myfunc')R = 103