change values in a text file, save it and run it with an executable
3 visualizzazioni (ultimi 30 giorni)
Mostra commenti meno recenti
Hello all!
I've got a text file that contains all the necessary parameters (80 in total) that I need in order to run it with an executable that I have.
I need to start a sensitivity analysis for one parameter of my text file, one at a time.
For example , in my txt file, I've got:
comments... comments... parameter A = [5 5 5 5] comments...
I want to change the values of parameter A, from 1 to 100, but each time, after every change of the parameter, I want to save the output of the text file, in order to run it with my executable file.
In simpler words, I want to open the txt file, change the parameter value,close the txt file, run it with the .exe file and save the output. And I want to do this 100 times.
Please help!
1 Commento
Fangjun Jiang
il 31 Ago 2011
You need to provide an example of your text file, especially how to identify and locate the parameter A. Basically you need to provide the text file to your .exe 100 times. Each time, the value of parameter is changed, right?
Risposte (1)
Christina
il 16 Set 2011
3 Commenti
Fangjun Jiang
il 16 Set 2011
Assume line188 is correct, textscan() should give the correct value. Then you need to wrap this in your for-loop.
line188='0.05 0.05 0.05 0.05 ! parameter A';
b=textscan(line188,'%f');
b=b{1}
b =
0.0500
0.0500
0.0500
0.0500
Vedere anche
Categorie
Scopri di più su Text Data Preparation in Help Center e File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!