maxSize=10;

mseError=zeros([maxSize,1]);
for i=1:maxSize
    ae=trainAutoencoder(trainingData,i,'ShowProgressWindow',false);
    predicted=predict(ae,trainingData);
    mseError(i)=mse(trainingData-predicted);
end