How to make Matlab close automatically
4 次查看(过去 30 天)
显示 更早的评论
Hi,
I have a .bat file that should start matlab and run an application, then close matlab. It has one line:
matlab -nodesktop -r runMyapp; exit;
It execute the job smoothly but after the execution, it does not close matlab. It seems like the exit does not do anything here.
What is the right way to make the matlab close automatically?
Thanks for any help.
Jennifer
0 个评论
回答(1 个)
dbmn
2016-7-28
Have you tried running your sequence of commands with quotation marks?
matlab -nodesktop -r "runMyapp; exit;"
Alternatively you could add exit to the end of your runMyapp script...
2 个评论
dbmn
2016-7-28
When using quotation marks the whole sequence of commands between the quotation marks is fed into the -r option.
When you do not use them - I am not sure, but I think - it just executes your command until the blank space/semicolon and then tries to interpret the next command as an additional option (and fails to do that).
Maybe someone can confirm this.
另请参阅
类别
在 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!