Duke-UNC Brain Imaging and Analysis Center
BIAC Forums | Profile | Register | Active Topics | Members | Search | FAQ
Username:
Password:
Save Password   Forgot your Password?
 All Forums
 Support Forums
 Unix Support
 Headless, batched MATLAB
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic  

charles.michelich
BIAC Alum

USA
176 Posts

Posted - May 21 2003 :  10:18:53 AM  Show Profile  Reply with Quote
Hello All,

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 $USER
To 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,
Chuck

Edited by - charles.michelich on May 21 2003 11:18:19 AM
  Previous Topic Topic Next Topic  
 New Topic  Reply to Topic
 Printer Friendly
Jump To:
BIAC Forums © 2000-2010 Brain Imaging and Analysis Center Go To Top Of Page
This page was generated in 0.12 seconds. Snitz Forums 2000