%% Return to Previous File in File-Set
% Return to a previous file in a file-set to get file information.
% 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)

% Get information for the second file again and recede the internal pointer to the second file.

prev = previousfile(fs)

%
% Copyright 2019 The MathWorks, Inc.