%% Encode Decoded Data for New Images  

%% 
% Load the sample data. 
X = digitTrainCellArrayData;

%%
% |X| is a 1-by-5000 cell array, where each cell contains a 28-by-28 matrix
% representing a synthetic image of a handwritten digit.  

%% 
% Train an autoencoder with a hidden size of 50 using the training data. 
autoenc = trainAutoencoder(X,50);  

%% 
% Encode decoded data for new image data. 
Xnew = digitTestCellArrayData;
Z = encode(autoenc,Xnew); 

%%
% |Xnew| is a 1-by-5000 cell array. |Z| is a 50-by-5000 matrix, where each
% column represents the image data of one handwritten digit in the new data
% |Xnew|.   



%% 
% Copyright 2012 The MathWorks, Inc.