Skip to main content

MATLAB on the ACCRE Cluster

MATLAB is a commercial programming language and computing environment that is widely popular in many areas of engineering and science. Since 2018, MATLAB has been free to use on the cluster for all ACCRE users.

Versions of MATLAB on the ACCRE Cluster

To see a list of installed versions of MATLAB on the cluster, use Lmod:

[jill@vmps12 ~]$ module avail MATLAB

Multiple versions of MATLAB are available on the cluster. We encourage users to use the most recent version of MATLAB (r2015a) installed, if possible, as we will not offer support for older versions indefinitely.

To load a particular version of MATLAB, use Lmod:

[jill@vmps12 ~]$ module load MATLAB/2017a
[jill@vmps12 ~]$ which matlab

If you are not in the MATLAB Unix group as described above, you will get an error when trying to load MATLAB in the first “module load” command. See the introduction above for more details about obtaining a MATLAB license for the ACCRE cluster.

In order to run MATLAB interactively, simply type matlab from the Linux command line:

[jill@vmps12 ~]$ matlab
MATLAB is selecting SOFTWARE OPENGL rendering.

              < M A T L A B (R) >
    Copyright 1984-2015 The MathWorks, Inc.
       R2015a ( 64-bit (glnxa64)
                February 12, 2015

To get started, type one of these: helpwin, helpdesk, or demo.
For product information, visit

    Academic License


Note that the MATLAB command prompt may take ~30-60 seconds to completely load, depending on which version you are using and whether you’ve loaded it previously in your current shell session. You can also load the full graphical user interface (GUI) to your local machine by logging into the cluster with X11 forwarding enabled (ssh -X <vunetid> In general, using the MATLAB GUI from the cluster will be very slow, especially if you are outside the Vanderbilt network, so we do not recommend it. Instead, most users develop their MATLAB code locally (from a laptop or desktop environment) for testing and then submit jobs to the cluster for batch (non-interactive) processing. Another option is to run MATLAB through a virtual desktop through the ACCRE Visualization Portal.

To see a list of the available Matlab toolboxes on the cluster, use the ver command from the MATLAB command prompt:

MATLAB Version: (R2015a)
MATLAB License Number: 299681
Operating System: Linux 2.6.32-220.2.1.el6.x86_64 #1 SMP Fri Dec 23 02:21:33 CST 2011 x86_64
Java Version: Java 1.7.0_60-b19 with Oracle Corporation Java HotSpot(TM) 64-Bit Server VM mixed mode
MATLAB                                                Version 8.5        (R2015a)
Simulink                                              Version 8.5        (R2015a)
Aerospace Blockset                                    Version 3.15       (R2015a)
Aerospace Toolbox                                     Version 2.15       (R2015a)
Bioinformatics Toolbox                                Version 4.5.1      (R2015a)
Communications System Toolbox                         Version 6.0        (R2015a)
Computer Vision System Toolbox                        Version 6.2        (R2015a)
Control System Toolbox                                Version 9.9        (R2015a)
Curve Fitting Toolbox                                 Version 3.5.1      (R2015a)
DSP System Toolbox                                    Version 9.0        (R2015a)
Database Toolbox                                      Version 5.2.1      (R2015a)
Datafeed Toolbox                                      Version 5.1        (R2015a)
Econometrics Toolbox                                  Version 3.2        (R2015a)
Embedded Coder                                        Version 6.8        (R2015a)
Filter Design HDL Coder                               Version 2.9.7      (R2015a)
Financial Instruments Toolbox                         Version 2.1        (R2015a)
Financial Toolbox                                     Version 5.5        (R2015a)
Fixed-Point Designer                                  Version 5.0        (R2015a)
Fuzzy Logic Toolbox                                   Version 2.2.21     (R2015a)
Global Optimization Toolbox                           Version 3.3.1      (R2015a)
Image Acquisition Toolbox                             Version 4.9        (R2015a)
Image Processing Toolbox                              Version 9.2        (R2015a)
Instrument Control Toolbox                            Version 3.7        (R2015a)
MATLAB Coder                                          Version 2.8        (R2015a)
MATLAB Compiler                                       Version 6.0        (R2015a)
MATLAB Compiler SDK                                   Version 6.0        (R2015a)
Mapping Toolbox                                       Version 4.1        (R2015a)
Model Predictive Control Toolbox                      Version 5.0.1      (R2015a)
Neural Network Toolbox                                Version 8.3        (R2015a)
Optimization Toolbox                                  Version 7.2        (R2015a)
Parallel Computing Toolbox                            Version 6.6        (R2015a)
Partial Differential Equation Toolbox                 Version 2.0        (R2015a)
RF Toolbox                                            Version 2.16       (R2015a)
Robust Control Toolbox                                Version 5.3        (R2015a)
Signal Processing Toolbox                             Version 7.0        (R2015a)
SimBiology                                            Version 5.2        (R2015a)
SimDriveline                                          Version 2.8        (R2015a)
SimElectronics                                        Version 2.7        (R2015a)
SimEvents                                             Version 4.4        (R2015a)
SimMechanics                                          Version 4.6        (R2015a)
SimPowerSystems                                       Version 6.3        (R2015a)
SimRF                                                 Version 4.4        (R2015a)
Simscape                                              Version 3.13       (R2015a)
Simulink 3D Animation                                 Version 7.3        (R2015a)
Simulink Coder                                        Version 8.8        (R2015a)
Simulink Control Design                               Version 4.2        (R2015a)
Simulink Design Optimization                          Version 2.7        (R2015a)
Stateflow                                             Version 8.5        (R2015a)
Statistics and Machine Learning Toolbox               Version 10.0       (R2015a)
Symbolic Math Toolbox                                 Version 6.2        (R2015a)
System Identification Toolbox                         Version 9.2        (R2015a)
Wavelet Toolbox                                       Version 4.14.1     (R2015a)

Note that ACCRE has a license for the Parallel Computing Toolbox , which allows for processing across multiple CPU cores and/or GPUs, and can therefore enable better performance (faster execution time) depending on the application.

Example Scripts

Running a MATLAB script within a SLURM job is generally straightforward. Unless you are attempting to run across multiple CPU cores using MATLAB’s Parallel Computing Toolbox, you will want to request a single task, load the appropriate version of MATLAB from your SLURM script, and then launch your MATLAB job. The following example runs a simple MATLAB script that demonstrates the utility of writing vectorized Matlab code:

[jill@vmps12 run1]$ ls
matlab.slurm  vectorization.m
[jill@vmps12 run1]$ cat matlab.slurm 
#SBATCH --nodes=1
#SBATCH --ntasks=1
#SBATCH --time=00:10:00
#SBATCH --mem=500M
#SBATCH --output=matlab_job_slurm.out

module load MATLAB   # load the default version of Matlab

matlab -nodisplay -nosplash < vectorization.m

The -nodisplay flag informs MATLAB you are operating in batch mode, while the -nosplash flag will prevent the splash screen from being displayed during startup. Additionally, you might try passing the -nojvm flag, which informs MATLAB that you do not need Java features for processing. Passing this flag often leads to faster MATLAB load-up times, but some I/O operations may depend on Java support so use this flag with caution. More information can be found on this page .

[jill@vmps12 run1]$ cat vectorization.m
% surrounding a block of code with tic and toc
% will time its execution

% non-vectorized code
i = 0;
for t = 0:.00001:10
i = i + 1;
y(i) = sin(t);

% vectorized code
t = 0:.00001:10;
y = sin(t);
[jill@vmps12 run1]$ sbatch matlab.slurm 
Submitted batch job 2135971

After waiting a few minutes:

[jill@vmps12 run1]$ ls
matlab_job_slurm.out  matlab.slurm  vectorization.m
[jill@vmps12 run1]$ cat matlab_job_slurm.out 

                 < M A T L A B (R) >
        Copyright 1984-2015 The MathWorks, Inc.
         R2015a ( 64-bit (glnxa64)
                   February 12, 2015

To get started, type one of these: helpwin, helpdesk, or demo.
For product information, visit

    Academic License

>> >> >> >> >> >> >> >> >> Elapsed time is 0.477166 seconds.
>> >> >> >> >> >> Elapsed time is 0.057248 seconds.

In this particular example no functions were defined in the vectorization.m file. Often users write scripts with functions, and need to call a function from the Linux command line. This can be accomplished by passing the MATLAB interpreter the -r option. For example:

matlab -nodisplay -nosplash -r "myFunc(1),quit()"

Here we are calling myFunc() and passing a single argument (1) to the function. It’s also necessary to call quit() afterwards to ensure your job ends once MATLAB processing has completed. You may also need to update your MATLAB path to include directories containing .m files and their function definitions. There are a few ways to accomplish this. The first way is to update your MATLABPATH Bash environment variable. Something like the following can be done within a SLURM script before MATLAB is launched:

export MATLABPATH=/home/jill/myDir

Alternatively, the path can be updated at runtime like so:

matlab -nodisplay -nosplash -r "addpath(genpath('/home/jill/myDir')),myFunc(1),quit()"

Contributing New Examples

In order to foster collaboration and develop local MATLAB expertise at Vanderbilt, we encourage users to submit examples of their own to ACCRE’s MATLAB Github repository . Instructions for doing this can be found on this page.


An older version of this article has been translated into Portuguese by Artur Weber. Some of the content in the translation may be out of date.