Contents Previous Next Subchapters

Checking For A File Or Directory
Syntax exists(file)
See Also isdir , rmfile , mvfile , fullpath

Returns a "true" value if the specified file or directory exists and a "false" value otherwise, where file is a character row vector.

If file includes a path, exists will return a true value only if the specified file or directory exists in that path. If your AUTOEXEC.BAT file is in the root directory of C:, and you enter
O-Matrix will respond
If file does not include a path, the exists function will look for file in the current directory. The commands
     if exists("TEMP.TMP") then rmfile("TEMP.TMP")
will delete a file named TEMP.TMP from the current directory, if it exists.