MATLAB QuickStart

MATLAB is short for MATrix LABoratory high-level language and interactive environment.


Show available versions of MATLAB

$ module avail MATLAB

Load the MATLAB module

$ module load MATLAB
Note: default version is MATLAB/R2020a

Please note, the module load command is case-sensitive.
If you don't include a version, the default is loaded.


Start an interative session with the interact command.

$ interact

Note: the default options will reserve 1 node with 1 cpu for 1 hour.
You can use interact --help to learn how to configure the script.

Within an interact session, you can load matlab and test your matlab code.

$ load MATLAB
$ matlab -options   < input-file  > output-file

Note: you can check the available toolkits in a running matlab session with var.

Note: once your testing is complete, exit your interact session before submitting your qsub reservation.


Job Submission Script (run_matlab.pbs)

#!/bin/bash
#PBS -l nodes=1:ppn=1
#PBS -l walltime=10:00:00
#PBS -m abe
#PBS -M your_email@kennesaw.edu
 
JOBID=`echo $PBS_JOBID | cut -f1 -d.`
 
module load MATLAB
 
# Create a temp workdir under scratch
mkdir -p ${HOME}/scratch/matlab
export PBS_MATLAB_WORKDIR=$( mktemp -d -p ${HOME}/scratch/matlab workdir_XXXXXXXXXX )
 
matlab -nodisplay -nosplash -logfile ${FILE}.log -r "run ${FILE}"
 
# Delete temp workdir
rm -rf ${PBS_MATLAB_WORKDIR}

Note: reservation is for 1 node with 1 cpu from the batch queue for 10 hours.

Usage:  qsub run_matlab.pbs -vFILE=${PWD}/matlab_script.m
Note: If you use the interact script, exit out before submitting with qsub.


MATLAB Documentation

©