MATLAB¶
MATLAB is a numerical computing environment for data analysis, algorithm development, and visualization. DIPC holds IKUR licenses that include all available toolboxes.
IKUR license
Load modules with the -IKUR suffix to access all toolboxes at no additional cost to your group.
Loading the module¶
module load MATLAB/2024b-IKUR
To see all installed versions across clusters, check the software catalog or run module spider MATLAB.
Expand to see all available modules on each cluster
MATLAB-IKUR/2023a-r5 |
MATLAB-IKUR/2024a-r4 |
MATLAB-IKUR/2024b |
MATLAB-IKUR/2025b |
MATLAB-IKUR/2025b-r1-iso |
MATLAB/2025b-r1 |
MATLAB-IKUR/R2020b |
MATLAB-IKUR/R2022a |
MATLAB/R2017b |
MATLAB/R2020b |
MATLAB-IKUR/R2022a |
MATLAB/R2011b |
MATLAB/R2014b |
MATLAB/R2018a |
MATLAB/R2018b |
MATLAB/R2019b |
MATLAB/R2020b |
MATLAB/R2022a-IKUR |
Batch job examples¶
#!/bin/bash
#SBATCH --qos=regular
#SBATCH --job-name=matlab
#SBATCH --nodes=1
#SBATCH --ntasks=1
#SBATCH --cpus-per-task=1
#SBATCH --mem=10G
#SBATCH --time=02:00:00
#SBATCH --output=%x.%j.out
#SBATCH --error=%x.%j.err
module load MATLAB/2024b-IKUR
matlab -nodisplay -nosplash -singleCompThread -batch "run('my_script.m')"
#!/bin/bash
#SBATCH --qos=regular
#SBATCH --job-name=matlab_par
#SBATCH --nodes=1
#SBATCH --ntasks=1
#SBATCH --cpus-per-task=8
#SBATCH --mem=32G
#SBATCH --time=08:00:00
#SBATCH --output=%x.%j.out
#SBATCH --error=%x.%j.err
module load MATLAB/2024b-IKUR
matlab -nodisplay -nosplash -batch "run('my_parallel_script.m')"
Inside your MATLAB script, match the worker count to --cpus-per-task:
parpool('local', str2double(getenv('SLURM_CPUS_PER_TASK')))
parfor i = 1:100
result(i) = expensive_function(i);
end
delete(gcp)
Always use -batch or -nodisplay -nosplash
Do not launch the MATLAB GUI on compute nodes. Use -batch "run('script.m')" (recommended, MATLAB R2019a+) or the older matlab -nodisplay -nosplash < script.m syntax.
End your script with exit
If you use the < script.m redirect syntax instead of -batch, add exit at the end of your .m file so MATLAB terminates when the script finishes. The -batch flag handles this automatically.
Compiling standalone executables¶
The MATLAB Compiler (mcc) creates standalone executables that run with the free MATLAB Runtime instead of a full license. This is useful for sharing code with colleagues who do not have MATLAB access or for reducing license contention.
module load MATLAB/2024b-IKUR
mcc -m my_script.m -R -singleCompThread
Run the resulting binary without loading MATLAB:
./run_my_script.sh /path/to/MATLAB/Runtime/v242
Tip
The -R -singleCompThread flag restricts the executable to one thread. Remove it only if your code uses explicit parallel constructs.
See also¶
-
Software catalog
Versions available on each cluster.
-
SLURM workload manager
Partitions, QoS, and job submission.
-
MathWorks documentation
Official MATLAB documentation and resources.