Running Matlab
UNIX:
To start Matlab in UNIX (either in a terminal or in a X-Windows session), type "matlab" at the prompt. To run a Matlab m-file in "batch", use the UNIX re-direction symbol ("<"). For example:
matlab < filename.m
Matlab reads each line of filename.m as if it was typed by the user at the Matlab prompt.
To end the Matlab session, type " quit " at the Matlab prompt (">>"). If you do not exit the program properly (i.e., if you quit by closing the Xterm or telnet session, rather than typing "quit"), the Matlab session does not end. It continues to use memory and CPU.
When running time-consuming M-files, it may be desirable to run Matlab in the background in order to work on something else or to log out of the computer. To run Matlab in the background, type the following command at the UNIX prompt.
nohup matlab < file.m > output &
where "file.m" is the M-file to be executed, and "output" is the file to which the output will be sent. Note the output file contains everything that would be printed on the screen if you run your job in interactive mode. In most cases, it only contains debugging messages and does NOT contain the results of your program. You need to include save command in your program to save the results to a physical file. If you are not interested in saving the output, you may specify /dev/null in the place of output.
The following example shows what it looks like:
>nohup matlab < test.m > /dev/null &
[1] 7414
>
[1]+ Done nohup matlab /dev/null