As I need to call Matlab scripts from the command, e.g., for running Matlab scripts in a batch, every once in a while, I post a little reminder for my self here. Keep in mind that the called Matlab command needs to have an exit at the end, otherwise Matlab will keep running, waiting for input.
In this example I am calling myscript and forward bash options $1 and $2 to it. Furthermore I am suppressing the GUI (-nodisplay), the Java Virtual Machine (-nojvm), the splash screen (-nosplash) and the Matlab Desktop (-nodesktop). Anyhow, the latte two options might be implied by suppressing the GUI already - but I’m not taking chances ;).
...