MATLAB: Run a program multiple times and report result

MATLAB

How to run a MATLAB program multiple times and write outputs to a text file?can we do this in matlab in windows environment? Please help ……. Thanking You, Sita

Best Answer

You do not have to restart Matlab to run a Matlab program. It is much faster to do this in a loop inside Matlab.
diary('D:\Temp\Result.txt');
for i = 1:10000
callYourFunction()
end
diary('off');
Of course you can use other methods than diary to create the log file, e.g.:
Str = evalc('callYourFunction')
and append the string Str to a text file. There are more possibilities, but currently the problem description is not clear enough to decide for a solution.