MATLAB start up option -batch no recognized

5 views (last 30 days)
I have the following code using MATLAB 2016B on Linux:
/usr/local/MATLAB/R2016b/bin/matlab -nodisplay -nosplash -batch "run myFunc(1)"
The same code (except the directory of the MATLAB executable and version number which is 2018b on my Macbook) works on my Macbook, but not on my Linux machine for some reason. It seems it's the -batch command that isn't being supported, but I've followed the documentation listed here: https://www.mathworks.com/help/matlab/ref/matlablinux.html
Specifically, I get the errors:
/usr/local/MATLAB/R2016b/bin/matlab: 1: eval: Syntax error: "(" unexpected
Unrecognized MATLAB option "batch".
This works on my Macbook but I'd like to have this running on my Linux Desktop. I have the command in a .sh file which I'm calling through C++ using the system(...) command in order to run simulations overnight. MATLAB does a specific function that I do not have access to in C++, which is why I'm doing this.
It works in Linux if I do: /usr/local/MATLAB/R2016b/bin/matlab -nodisplay -nosplash -r "run myFunc(1); exit"
While I do have a solution, I'd like to understand why the original statement doesn't work in Linux.

Accepted Answer

Sean de Wolski
Sean de Wolski on 13 May 2019
Edited: Sean de Wolski on 13 May 2019
The -batch option was added in R2019a.

More Answers (0)

Categories

Find more on Startup and Shutdown in Help Center and File Exchange

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!