How to run MATLAB files in batch mode or as a batch process
조회 수: 39 (최근 30일)
이전 댓글 표시
MathWorks Support Team
2017년 5월 18일
답변: MathWorks Support Team
2017년 5월 24일
How do I run a MATLAB script or function in batch mode in Windows?
채택된 답변
MathWorks Support Team
2017년 5월 18일
You can use the following command to run a MATLAB script in batch mode from the Windows Command Prompt:
matlab -nosplash -noFigureWindows -r "try; run('C:\Path\To\YourScriptName.m'); catch; end; quit"
To be safe, "YourScriptName.m" should have instructions to cd() to the directory it is to work in. The command "run" cannot be used with functions but only with scripts. For functions please use the following syntax:
matlab -nosplash -noFigureWindows -r "try; cd('C:\Path\To\'); YourFunctionName(); catch; end; quit"
The above commands could be put into a BAT file and invoked from any directory.
댓글 수: 0
추가 답변 (0개)
참고 항목
카테고리
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!