MATLAB Answers

-r vs -batch when calling matlab in unix

7 views (last 30 days)
I am aware that matlab -r scriptName(arg1,...) is no longer recommended for non-interactive jobs on unix systems, and that I should use -batch instead (see ).
However, I have been unable to find why that is better. Could someone point me in the right direction?


Sign in to comment.

Accepted Answer

Edric Ellis
Edric Ellis on 23 Mar 2020
(I'm not an expert here, just a user of the -batch option) The main advantages for me of the -batch option compared to -r for non-interactive cases are:
  • it more concisely sets up the -nosplash and -nodisplay options (even on Windows)
  • removes the startup banner
  • ensures the MATLAB process exits (with an exit code) even if your statement throws an error
All told, it's just more convenient.

More Answers (0)




Translated by