run a program multiple times and report result
조회 수: 1 (최근 30일)
이전 댓글 표시
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
댓글 수: 2
Jan
2012년 1월 23일
Please decide, if you want to run a C-program, like in the header, *or* a Matlab program, like in the body of the question.
채택된 답변
Jan
2012년 1월 24일
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.
댓글 수: 0
추가 답변 (1개)
Walter Roberson
2012년 1월 23일
matlab -r YourFunctionName > OutputFileName
댓글 수: 4
Walter Roberson
2012년 1월 24일
Sorry, as I indicated, I do not have much experience with Windows BAT files. At home I am running all Mac, and at work I only have access to Linux systems.
참고 항목
카테고리
Help Center 및 File Exchange에서 Startup and Shutdown에 대해 자세히 알아보기
제품
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!