Is it possible that we can save .m file results with different name each time of execution?
Ältere Kommentare anzeigen
Hello everyone, I have a Boundary.m file which is storing few results in result.txt file. I want to run that Boundary.m file for 10 times. But I want to preserve my result.txt file for each execution. Normally if I run
for i=1:10
Boundary
end
Then offcourse my result.txt file is over written everytime. But what I want to have 10 different result.txt file for all the 10 execution.
Is it possible?
Thanks in advance, KM
PS: Its a geo file that I will use later on for creation of 10 different geometries by gmsh.
Akzeptierte Antwort
Weitere Antworten (1)
Mischa Kim
am 10 Nov. 2017
0 Stimmen
@km, take a look at the documentation here. Appending allows you to store all data in one and the same file vs 10 different ones.
4 Kommentare
@km
am 10 Nov. 2017
@km
am 10 Nov. 2017
Mischa Kim
am 10 Nov. 2017
Gotcha. How about (as an example)...
for ii = 1:10
fileID = fopen(['result', num2str(ii),'.txt'],'w');
fmt = '%5d %5d %5d %5d\n';
fprintf(fileID,fmt, magic(4));
fclose(fileID);
end
@km
am 10 Nov. 2017
Kategorien
Mehr zu Whos finden Sie in Hilfe-Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!