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 CenterFile Exchange에서 Startup and Shutdown에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by