MATLAB (matrix laboratory) is a multi-paradigm numerical computing environment and can be used on the Cluster interactively on the Frontend (scc) or in a job (without graphical user interface).
There are several ways to use MATLAB which should be selected for convenience.
MATLAB can be called vi the link /software/bin/matlab (or /software/bin/matlab-2020a, etc. for other versions) or by loading the module:
module load matlab matlab
The module is recommend since it sets important environment variables.
To use MATLAB in a job, it needs to be started without graphical user interface. This can be done with
matlab -batch matlab_script
where matlab_script.m is the MATLAB script to run.
When using MATLAB older than 2019a you need to run
matlab -nodisplay -nodesktop -nosplash -r matlab_script
Here is a simple job script (including necessary increased memory limit of 10GB):
#$ -N matlab_job #$ -l h_vmem=10G module load matlab matlab -batch matlab_script
Parallel usage
To use parallelization in MATLAB you should select the parallel environment "smp" and the correct number of threads. Just add the line(for 8 threads)
#$ -pe smp 8
to the job script.
Now you can start a parpool or/and use parfor, etc.
parpool('local',8) parfor (i=1:N,8)