www.gusucode.com > nnet 案例源码 matlab代码程序 > nnet/EncodeDecodedDataforNewImagesExample.m

    %% Encode Decoded Data for New Images  

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

%%
% |X| is a 1-by-5003 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-4997 cell array. |Z| is a 50-by-4997 matrix, where each
% column represents the image data of one handwritten digit in the new data
% |Xnew|.