If you want to run MATLAB in a "batch mode" you can use the following command:
matlab -nodisplay < test.m >> test.log &This command will start MATLAB without a display, run the script test.m, and then exit MATLAB. Anything that would have appeared in the MATLAB command window will be appended to test.log. The & causes the program to run in the background so that you can do other things from that shell.
Note that there is no way to interact with MATLAB when running in batch mode other that stopping the job using the kill command. If an error occurs while running the script, MATLAB will exit. Look in test.log (or whatever file to directed the output to) for the error messages.
If you attempt to exit the shell before the script is finished, you will receive a warning that "There are stopped jobs" and the shell will continue to run. If you attempt to exit twice in a row, the MATLAB script (and any other stopped jobs) will be terminated without finishing.
To see a list of the programs that you are running from the current shell, type
ps To see a list of all the programs that you are running, type
ps -u $USERTo run a job that will continue to run after you log out, add nohup to the beginning of the command. For example:
nohup matlab -nodisplay < test.m >> out.txt &Enjoy,