Error while running Matlab code on Ubuntu command line (with -nojvm option)
matlab -nodisplay -nojvm -r '3*4, exit'
MATLAB is exiting because of fatal error
Problem: exit command is called before Matlab has fully started
Solution 1: avoid option -nojvm if you don't need
Solution 2: add a short break (1 second) before exit
matlab -nodisplay -nojvm -r '3*4, pause(1); exit'