Save multiple run result of script
9 views (last 30 days)
Show older comments
Hi i'm writing a code with matlab, i wonder if there is a way to save the result of my script every time i run it.Example if i run this code multiple times i want to get all different outputs in my vector or file in case of using save function.
s=[];
s=fitness(D,vect);
Because every time i execute, it overwrites the last result.
Thank you.
0 Comments
Accepted Answer
KL
on 20 Nov 2017
Edited: KL
on 20 Nov 2017
EDITED
numOfRuns = 5;
for n=1:numOfRuns
s = fitness(D,vect);
save(['result_data_run_number_' num2str(n) ',mat'],'s');
end
5 Comments
KL
on 20 Nov 2017
You will get different results only if you change some of your code. I only showed you how to run a code multiple times and store the outcome in different mat files.
Put the part of the code you want to repeat inside for loop and save should be at the end of the loop.
More Answers (1)
See Also
Categories
Find more on Java Package Integration in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!