How to store data in a for loop
1 vue (au cours des 30 derniers jours)
Afficher commentaires plus anciens
Khoo Wei Yang
le 17 Mar 2021
Réponse apportée : ANKUR KUMAR
le 17 Mar 2021
for i=1:100
trainin = x(:,tr.trainInd);
trainTarg1= t(:,tr.trainInd);
trainout = sim(net,trainin);
[m1,b1,r1]=postreg(trainout,trainTarg1);
end
So this is training for the neural network, and i need to get the r1 value for each loop. How do i do this?
0 commentaires
Réponse acceptée
ANKUR KUMAR
le 17 Mar 2021
If you wish to save into cell, then you can use:
for i=1:100
trainin = x(:,tr.trainInd);
trainTarg1= t(:,tr.trainInd);
trainout = sim(net,trainin);
[m1,b1,r1{i}]=postreg(trainout,trainTarg1);
end
If r1 is 1D array, you can save in 2d array:
for i=1:100
trainin = x(:,tr.trainInd);
trainTarg1= t(:,tr.trainInd);
trainout = sim(net,trainin);
[m1,b1,r1(:,i)]=postreg(trainout,trainTarg1);
end
0 commentaires
Plus de réponses (0)
Voir également
Catégories
En savoir plus sur Deep Learning Toolbox dans Help Center et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!