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

后端 未结 2 653
一个人的身影
一个人的身影 2020-12-19 09:00

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.

F

相关标签:
2条回答
  • 2020-12-19 09:19

    write down in the last line of your .m file and when you run your simulation after it shows result it will quit itself.

    [...] % code
    
    quit
    
    0 讨论(0)
  • 2020-12-19 09:38
    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"
    
    0 讨论(0)
提交回复
热议问题