%% Specify Images to Read
% Create a datastore containing four images and preview the first image.

ds = datastore({'street1.jpg','street2.jpg','peppers.png','corn.tif'},'DatastoreType','image','FileExtensions',{'.jpg','.png','.tif'})

%

imshow(preview(ds));

%
% Read only the second and third images, one at a time.

for i = 2:3
    img = readimage(ds,i);
end

%
% Read all four images at once and view the fourth image.

imgs = readall(ds);
imshow(imgs{4})

% Copyright 2015 The MathWorks, Inc.