%% Determine If Current Directory Is Last Directory
% Create a Tiff object for a file and determine if the current directory is the last directory in the file. If the current directory is the last directory, then the lastDirectory function returns 1. Otherwise, the function returns 0.

t = Tiff('example.tif','r');
lastDirectory(t)

% Set the current directory to directory number 3 and check if it is the last directory in the file.

setDirectory(t,3);
lastDirectory(t)

% Close the Tiff object.

close(t);