Skip to content

Instructions for using Matlab software

Matlab is programming platform for analysing and designing systems, primary for numeric computing. Supports matrix manipulations, data plotting, implementation of algorithms, development of user interfaces, etc. Programs written in Matlab, can use libraries written in C, C++, Java and Fortran. Developed by MathWorks, read more


Matlab is a licensed software, HPC Vega offers Standard Concurrent license, which is intended to be used by multiple users simultaneously.

  • MATLAB Distrib Comp Engine (Total of 400 licenses issued)
  • MATLAB (Total of 1 license issued)
  • MATLAB Distrib Computing Toolbox (Total of 1 license issued)

Read more about our concurrent license at link.


Matlab version R2022a is available on HPC Vega, through module.

module load matlab

Matlab user interfaces

For the graphical user interface (GUI), X11 forwarding must be enabled on the client site, otherwise an interactive command line session will begin. The easiest way to check this is echo $DISPLAY, if value is not specified, the forwarding does not work.

Graphical user interface (GUI)

matlab -display Xdisplay

Command line interface (CLI)

matlab -nodisplay 

For additional information about Matlab commands, load module from your shell and check the help section.

matlab -h

Example of a Slurm task

The following example shows a task that will be run on 2 nodes and 12 cores. The job requires 2 GB RAM per core and will be carried out for 5 minutes on cpu partition.

Content of inputfile matlabtest.m:

function helloworld
   disp('Hello World!')

Content of SBATCH script:


#SBATCH --job-name=matlab-test
#SBATCH --time=00:05:00
#SBATCH --partition=cpu
#SBATCH --nodes=2
#SBATCH --ntasks-per-node=1
#SBATCH --cpus-per-task=12

module load matlab/matlab-R2022a

matlab -nodisplay -r matlabscript

!!! Note: Input file, e.g. shell or sbatch script must be exclude .m, output will be written inside slurm-<jobid>.log.

Example of sending with ARC

Firstly you will need ARC Client and a .xrsl file in which you state which resources you need to start the job, and contains two additional input files.

(count = 12)
(countpernode = 2)
(jobname = matlab-test)
(inputfiles = 
  ("" "")
  ("matlabscript.m" "")
(executable =
(outputfiles = ("example.out" ""))
(walltime="5 minutes")

Example of


#Setup environment
. /ceph/hpc/software/

#Load module
module --ignore-cache load matlab

#Execute script
matlab -nodisplay -r matlabscript

For input script examples e.g. matlabscript.m, check the official documentation.