Class: matlab.io.datastore.DsFileSet
Package: matlab.io.datastore
Information on next file or file chunk
fileInfo = nextfile(fs)
returns the information on the next file available in the file set object
fileInfo
= nextfile(fs
)fs
. Subsequent calls to the nextfile
function
continue reading from the endpoint of the previous call.
Create a file-set object and get the file information iteratively, one file at a time.
Create a file-set object for all .mat
files in the
demos
folder.
folder = fullfile(matlabroot,'toolbox','matlab','demos'); fs = matlab.io.datastore.DsFileSet(folder,... 'IncludeSubfolders',true,... 'FileExtensions','.mat');
Get the file information from the file-set object fs
, one file
at a
time.
while hasfile(fs) file = nextfile(fs); end
The nextfile
method returns an error if no more files exist
in the file-set object fs
. To avoid this error, use
nextfile
along with hasfile
and
reset
. The hasfile
method checks if
files still remain in the file-set object, while the reset
method resets the internal file pointer to the beginning of the file-set
object.
hasfile
| matlab.io.datastore.DsFileSet
| matlab.io.datastore.FileSet
| maxpartitions
| partition
| reset
| resolve