How can I write different ouput values for each for-loop?
Mostra commenti meno recenti
I am trying to write the outputs in a text file using with the for loop and a function. After working the code in thee workspace I see the outputs for MAPE values at the each loop but in the text file it gets the one value it does not change. I use neural network function for MAPE values.How can I write the different MAPE values for each loop in the text file?
fileID=fopen('Donguu.txt','w+');
for lrate=0.1:0.2:0.2
for trainingrate=0.2:0.4:0.8
for n1=3:2:7
for n2=6:2:10
NeuralNetwork(Input, Target, trainingrate, n1, n2, lrate);
fprintf(fileID, '%d, %d, %d, %d, %d\n', lrate, trainingrate, n1, n2, MAPE);
end
end
end
end
lrate=6.000000e-01, trainingrate=2.000000e-01, n1=3, n2=6
MAPE =
0.6875
lrate=6.000000e-01, trainingrate=2.000000e-01, n1=3, n2=8
MAPE =
0.6354
lrate=6.000000e-01, trainingrate=2.000000e-01, n1=3, n2=10
MAPE =
0.7353
6 Commenti
Walter Roberson
il 10 Set 2018
You do not appear to be writing to a text file: your fprintf() does not have a file identifier as the first parameter, and you are not passing a file identifier to NeuralNetwork() to write to.
Are you using diary() to write to a text file?
Perihan Bilgeç
il 10 Set 2018
Geoff Hayes
il 10 Set 2018
Perihan - do you close the file with fclose?
Walter Roberson
il 10 Set 2018
MAPE is not calculated by any of the code you posted. Is NeuralNetwork doing an assignin('caller', 'MAPE', ...) or is it simply displaying the value ?
Perihan Bilgeç
il 10 Set 2018
Perihan Bilgeç
il 10 Set 2018
Modificato: Walter Roberson
il 10 Set 2018
Risposta accettata
Più risposte (1)
Perihan Bilgeç
il 11 Set 2018
0 voti
Categorie
Scopri di più su Operations on Strings in Centro assistenza e File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!