Checks for existence of any UNIX file.
Available in version 6.2.1 and later.
function fileexists ( file_path : string ) return_val [dimsizes(file_path)] : logical
A scalar string or a multi-dimensional array of strings containing the full or relative path to UNIX files (Unix pathname string) for which to check presence on the filesystem.
The output of fileexists is a logical variable with the same dimension sizes as the input.
The function fileexists returns True for every element of file_path that is present, and False if not.
The following code will determine if an ASCII file named "StationData.csv" exists before trying to read it in:
filename = "StationData.csv" if (fileexists(filename)) then lines = asciiread (filename,-1,"string") end if
The following code will determine if each of a group of files called "StationData_1.txt", "StationData_2.txt", ..., "StationData_5.txt" exists: