Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I quit MATLAB after execution is finished through command?

Tags:

matlab

Instead of writing quit in my .m file, can I do this through command? I want to close MATLAB right after the file execution is completed.

For example, this is my command

matlab -nodisplay < my_script

Thank you very much.


This is the actual command I was trying to make

matlab -nodisplay -nodesktop -nosplash -nojvm -r "try, basic_plot;end, quit"
like image 599
CppLearner Avatar asked Feb 17 '12 23:02

CppLearner


1 Answers

matlab -nosplash -nodesktop -r "my_script; quit"

Edit:

Following Edric's recommendation, you'd better use one of these:

matlab -nosplash -nodesktop -r "try, my_script; end, quit"
matlab -nosplash -nodesktop -r "try, my_script; catch, disp('failed'), end, quit"
matlab -nosplash -nodesktop -r "try, my_script; catch e, your_error_handling_function(e), end, quit"
like image 173
Simon Avatar answered Sep 20 '22 02:09

Simon