isfile
Tests whether a name is an existing file.
Category: Programming > Files and Folders
Syntax
tf = isfile(name)
Returns true if name is a file.
Description
isfile is true only for regular files: folders and names that do not exist give false. Unlike exist, it does not look on the search path, only at the name given.
With a cell array or string array it tests every name and returns an array of the same size.
Input arguments
name- File name as text, a string array, or a cell array of names.
Output arguments
tf- Logical array with one entry per name.
Example
One name and several
writelines('data', 'a.txt');
isfile('a.txt')
isfile('nothere.txt')
isfile({'a.txt', '.', 'zzz'})
Output
ans = logical
1
ans = logical
0
ans = 1×3 logical array
1 0 0