How can I run commands in the background from MATLAB with Windows?

7 ビュー (過去 30 日間)
MathWorks Support Team
MathWorks Support Team 2009 年 6 月 27 日
編集済み: MathWorks Support Team 2021 年 5 月 20 日
I would like to run a MATLAB script in batch mode in the background. If I use "!" or SYSTEM or DOS to start MATLAB, it does not return until the script has completed.

採用された回答

MathWorks Support Team
MathWorks Support Team 2021 年 6 月 24 日
編集済み: MathWorks Support Team 2021 年 5 月 20 日
You can run any command in the background by using a BAT-file which contains the command you would like to run. For example, if you want to start MATLAB in the background and run a command, you can create the following BAT-file:
@echo off
matlab -automation -r "surf(peaks); pause(5); quit" > matlab_output.log
exit
Then, inside MATLAB, the following command will run the script in the background:
!start "MATLAB test" /Min /B test_bat.bat
The syntax for the START command is explained in the following website:
Attached is an example BAT-file: "test_bat.bat".

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeFunctions についてさらに検索

製品


リリース

R2008a

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by