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"
matlab -nosplash -nodesktop -r "my_script; quit"
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"
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With