Navigation

Operators and Keywords

Function List:

C++ API

Built-in Function: exist (name, type)

Return 1 if the name exists as a variable, 2 if the name is an absolute file name, an ordinary file in Octave's path, or (after appending ‘.m’) a function file in Octave's path, 3 if the name is a ‘.oct’ or ‘.mex’ file in Octave's path, 5 if the name is a built-in function, 7 if the name is a directory, or 103 if the name is a function not associated with a file (entered on the command line).

Otherwise, return 0.

This function also returns 2 if a regular file called name exists in Octave's search path. If you want information about other types of files, you should use some combination of the functions file_in_path and stat instead.

If the optional argument type is supplied, check only for symbols of the specified type. Valid types are

"var"
Check only for variables.
"builtin"
Check only for built-in functions.
"file"
Check only for files and directories.
"dir"
Check only for directories.

See also: file_in_loadpath, file_in_path, find_dir_in_path, stat.

Package: octave