All MATLAB sessions should be run from the compute nodes.
cd
– change to your Matlab directory.workgroup
– activate your workgroup.qlogin
salloc
vpkg_require
– Add Matlab and dependencies to your environment. Once you are successfully connected to a compute node, then you can start MATLAB in command line mode or run scripts.
matlab -nodesktop -nosplash
You will still have access to the help browser (doc command), the editor (edit command), and graphics (plot command for example).
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.
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.
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.