%% Create a File-Set and Get Information On All Files
% Create a file-set and query information for specific files in the file-set.
% 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)

% Obtain information for specific files using either the nextfile function or by querying the FileInfo property and specifying an index. Obtain information for consecutive files using nextfile. For example, obtain information for the first two files in the set.

file1 = nextfile(fs)
file2 = nextfile(fs)

% Query the FileInfo property to get information about the last file in the set.

lastfile = fs.FileInfo(4)

% Copyright 2019 The MathWorks, Inc.