%% Check If File-Set Has Previous File
% Check if a file-set has a previous file available to process.
% 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)

% Get the information for the first file and move the internal pointer forward one file.

file1 = nextfile(fs)

% Get information for the second file and move the internal pointer forward one file.

file2 = nextfile(fs)

% Check to see if a previous file exists. In this case, the result is true because a previous file exists.

tf = hasPreviousFile(fs)

% Copyright 2019 The MathWorks, Inc.