%% Preview Data in CombinedDatastore
% Create a datastore that maintains parity between the pair of images of the underlying datastores. For instance, create two separate image datastores, and then create a combined datastore representing the two underlying datastores.
% Create an image datastore imds1 representing a collection of three images.

imds1 = imageDatastore({'street1.jpg','street2.jpg','peppers.png'}); 

% Create a second datastore imds2 by transforming the images of imds1 to grayscale and then reflecting the images horizontally.

imds2 = transform(imds1,@(x) fliplr(im2gray(x)));

% Create a combined datastore from imds1 and imds2.

imdsCombined = combine(imds1,imds2);

% Preview the data in the combined datastore. The output is a 1-by-2 cell array. The two columns represent the first subset of data from the two underlying datastores imds1 and imds2, respectively.

dataOut = preview(imdsCombined)

% Display the previewed data as a pair of tiled images.

tile = imtile(dataOut);
imshow(tile)

% Copyright 2018 The MathWorks, Inc.