Run matlab in batch mode
Use option "-r MATLAB_command" to run matlab in batch mode.
Automatically run the specified MATLAB M-file, either commands supplied with MATLAB or your own M-files, immediately after MATLAB starts. This is also referred to as calling MATLAB in batch mode. Separate multiple commands with commas or semicolons (;). M-files must be on the MATLAB path or in the MATLAB startup directory. Do not include the pathname or a file extension.
Example: matlab -nojvm -nosplash -r MyCommand
Reference: MATLAB Documentation - Desktop Tools and Development Environment - Startup Options
We can now use "system" (need to include < cstdlib >) to call a shell-script, which in turn calls matlab to do something.