====== Interactive MATLAB tips ======
Starting MATLAB in command line mode or running scripts on a Compute node.
All MATLAB sessions should be run from the compute nodes.
- **''cd''** -- change to your Matlab directory.
- **''workgroup''** -- activate your workgroup.
- **''qlogin''** -- logon an available compute node.
- **''vpkg_require''** -- Add Matlab and dependencies to your environment.
**Details by clusters**
* [[software:matlab:Mills]]
* [[software:matlab:Farber]]
===== Command line Matlab =====
To start in command line mode (no GUI)
matlab -nodesktop -nosplash
You will still have access to the help browser (**doc** command), the editor (**edit** command), and graphics (**plot** command for example).
===== Command Line Matlab with no X11 display =====
**Command Line Matlab with no X11 display**
If you do not have an X11 server, or you do not need a display, start MATLAB with
matlab -nodisplay
The **doc** command is not available, but you still can use the **help** command. You can use the **edit** command, provided you had exported the EDITOR environment variable, For example, to use **vim** as your editor:
env EDITOR=vim matlab -nodisplay
You can't display graphics, but you can export graphics to a file.
===== Execute a MATLAB script =====
**Execute a MATLAB script**
If your have MATLAB commands in a ''script.m'' file, then start with the command
matlab -nodisplay -r script
All the text output from the script will appear on the terminal screen. If this last command in the ''script.m'' file is **quit** or **exit** you will be returned the bash prompt.
===== Execute a MATLAB script detached from the terminal =====
If you have MATLAB commands in a ''script.m'' file, start with the command
nohup matlab -nodisplay -r script &
All the text output from the script will be appended to the file ''nohup.out''. You will be returned immediately to the bash prompt while the script runs in the background. If you exit or logout the interactive terminal session the MATLAB job will continue to execute, writing output to ''nohup.out'' and exporting graphics to files.
You should not read from the terminal in your script. Without the **nuhup**, MATLAB may respond to any hangup signal from your terminal shell by stopping execution. Reading input from the terminal may cause your MATLAB job to stay loaded, waiting for input.
===== Cluster details =====
**Using MATLAB details by cluster**
* [[software:matlab:Mills]]
* [[software:matlab:Farber]]