%% Check If File-Set Has Another File
% Check if a file-set has another file and read the data iteratively.
% Create a file-set fs for a collection of files.

folder = {'accidents.mat','airlineResults.mat','census.mat','earth.mat'}
fs = matlab.io.datastore.FileSet(folder)

% Use the hasNextFile and nextfile functions to read file information one file at a time while files remain in the set.

while hasNextFile(fs)
   file = nextfile(fs)
end

% Copyright 2019 The MathWorks, Inc.