Cookies on this website

We use cookies to ensure that we give you the best experience on our website. If you click 'Accept all cookies' we'll assume that you are happy to receive all cookies and you won't see this message again. If you click 'Reject all non-essential cookies' only necessary cookies providing core functionality such as security, network management, and accessibility will be enabled. Click 'Find out more' for information on how to change your cookie settings.

How to submit non-interactive MATLAB scripts to the queues

Wherever possible DO NOT run full MATLAB directly on the cluster, instead compile your code (see the MATLAB page) but where this is not possible or you only need to run a quick single job task it is acceptable to run the full MATLAB environment on the cluster. ​

Any non-interactive MATLAB task needs to be submitted by creating a file (typically with the extension '.m'), eg 'myfile.m' with all your MATLAB commands in and submit it using 'fsl_sub'; once the task is running you can look at the file "matlab.o<jobid>" for any output. 

fsl_sub -q short.q matlab -singleCompThread -nodisplay -nosplash \< mytask.m

NB The "\" is very important since MATLAB won't read your script otherwise.

Warning: MATLAB tasks will often attempt to carry out some operations using multiple threads. Our cluster is configured to run only single thread programs, so if multiple threads are used you can overload it. The ''-singleCompThread'' option disables this multi-threading.

Although many built-in functions in MATLAB are multi-threaded the cluster is configured to prevent any task running threads on more than one CPU unless run within a parallel environment.

Request a parallel environment and ensure that your MATLAB script includes the lines:

N = getenv(NSLOT_VAR)
LASTN = maxNumCompThreads(N)

For tasks that require graphical output (for example to display progress bars), please see the Virtual X11, and where you must interact with the process see the section on the interactive queue