how to make the command line invisible

1 回表示 (過去 30 日間)
Roger
Roger 2016 年 1 月 15 日
コメント済み: Walter Roberson 2016 年 1 月 15 日
i use "start matlab -nosplash -nodesktop -minimize -r test" to start my script ,but it did show the command line , i did not want this command line show out , how to make it ?

回答 (1 件)

Walter Roberson
Walter Roberson 2016 年 1 月 15 日
You always need somewhere for the output to go, even if you are coding for it to be thrown away.
If you script does not quit MATLAB (or something goes wrong with the script) then MATLAB is going to want to prompt for input, and it is going to need a command line for that.
start matlab -nosplash -nodesktop -minimize -r "try test; catch; end; quit" > NL0:
The try/catch ensures that there is smooth control even if there is an error in the script. The quit ensures that MATLAB exits after the script. The redirection to NL0: throws away any output. (NL: or NL0: is specific to MS Windows; the OS-X and Linux equivalent is /dev/null . On the other hand, neither OS-X nor Linux would use "start")
You might end up needing -nojvm as well.
  2 件のコメント
Roger
Roger 2016 年 1 月 15 日
thanks, i tried it , but the script run and then quit quickly. just showing one second
Walter Roberson
Walter Roberson 2016 年 1 月 15 日
What behaviour did you want then?
If "test" starts a GUI and you want it to run without command line and leave when the GUI exits, then in the routine that creates the graphics interface you need to waitfor() the figure right before returning.

サインインしてコメントする。

カテゴリ

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