MATLAB: Cross validation for neural network

cross-validationneural networkno of hidden neurons

i want to use cross validation method to decide the number of hidden neurons of a neural network.
i want 5 fold cross validation. and right now i am using following NN architecture:
if true
net=newff(minmax(in'),[7,3],{'tansig','purelin'},'traingdx');
net.trainParam.show = 50;
net.trainParam.lr = 0.05;
net.trainParam.mc = 0.7;
net.trainParam.epochs = 3500;
net.trainParam.goal = 1e-2;
a1 = net.b{1};
a2 = net.b{2};
w1 = net.iw{1};
w2 = net.lw{2};
end
how can i use cross validation for this. and where the errors of each fold will be stored……

Best Answer

Search the NEWSGROUP and ANSWERS using
greg crossvalidation
and
greg cross-validation
and
greg cross validation
Please post the addresses of any posts that are useful.
Hope this helps.
Thank you for formally accepting my answer
Greg