How can I write different ouput values for each for-loop?
Mostrar comentarios más antiguos
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 comentarios
Walter Roberson
el 10 de Sept. de 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ç
el 10 de Sept. de 2018
Geoff Hayes
el 10 de Sept. de 2018
Perihan - do you close the file with fclose?
Walter Roberson
el 10 de Sept. de 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ç
el 10 de Sept. de 2018
Perihan Bilgeç
el 10 de Sept. de 2018
Editada: Walter Roberson
el 10 de Sept. de 2018
Respuesta aceptada
Más respuestas (1)
Perihan Bilgeç
el 11 de Sept. de 2018
0 votos
Categorías
Más información sobre Operations on Strings en Centro de ayuda y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!