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

    %% Decode Encoded Data For New Images  

%% 
% Load the training 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 using the training data with a hidden size of 15. 
hiddenSize = 15;
autoenc = trainAutoencoder(X,hiddenSize);  

%% 
% Extract the encoded data for new images using the autoencoder. 
Xnew = digitTestCellArrayData;
features = encode(autoenc,Xnew);  

%% 
% Decode the encoded data from the autoencoder. 
Y = decode(autoenc,features); 

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