hasfile
Class: matlab.io.datastore.DsFileSet
Namespace: matlab.io.datastore
Determine if more files are available in file-set object
Syntax
tf = hasfile(fs)
Description
tf = hasfile(
returns logical
fs
)1
(true
) if any more files are available to
process in the DsFileSet
object specified by fs
.
Otherwise, it returns logical 0
(false
).
Input Arguments
Examples
Check if File-set Object has More Files
Create a file-set object, check if the file-set object has any files, and then read the data iteratively.
Create a file-set object for all the .mat
files in the
demos
folder.
folder = fullfile(matlabroot,'toolbox','matlab','demos'); fs = matlab.io.datastore.DsFileSet(folder,... 'IncludeSubfolders',true,... 'FileExtensions','.mat');
Use the hasfile
method to check if the file-set object has more
files to read. Get the file information, one file at a time, while files remain in
the file-set
object.
while hasfile(fs) file = nextfile(fs); end
Version History
Introduced in R2017b
See Also
matlab.io.datastore.DsFileSet
| maxpartitions
| nextfile
| partition
| reset
| resolve