MATLAB script run through terminal

2 ビュー (過去 30 日間)
Rupamathi Jaddivada
Rupamathi Jaddivada 2017 年 6 月 17 日
回答済み: Walter Roberson 2017 年 6 月 18 日
Hi, I used the command 'matlab -r 'try filename(args); catch;end;quit' in order to run a simulation remotely. However, I don't know how to check the status of completion. I don't even know how to stop the simulation. Please let me know if there is anyway I can resolve these issues.
Thanks, Rupa

回答 (1 件)

Walter Roberson
Walter Roberson 2017 年 6 月 18 日
The completion of the MATLAB command itself can be checked in most shells by looking at the $? variable; http://www.linuxnix.com/find-exit-status-script-command-linux/
If you are talking about the status of individual commands within the function, you can look at the standard output. If you want to write stdout to a file while still looking at it interactive, use the shell tee command. The question of when exactly MATLAB flushes its output buffer can be important in some cases.
You could also consider using the MATLAB diary command.
"I don't even know how to stop the simulation"
If you are running interactively in a shell, then unless you have altered your termios settings (by using the stty command, probably), you can control-c to interrupt the execution, or you can (probably) control-Z to pause the execution. Sometimes execution gets stuck beyond the ability of control-C to fix it, or if you are not running interactively, you may need to kill the process.

カテゴリ

Help Center および File ExchangeStartup and Shutdown についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by