Skip to content

Matlab

Running interactively

Interactive sessions of matlab are best run on Katana OnDemand.

Batch Jobs

You can run matab within a batch job. The example below shows the flags used to start matlab without a graphical interface. The matlab script (scriptfile.m) needs to be in the same directory as qsub was run to submit the batch job.

module load matlab/R2022a

matlab -nodisplay -nosplash -r scriptfile

If you wish to submit the job from a different directory than your matlab script, you need to provide the full file path to cd (change directory) command with matlab. Note the use of quotes.

module load matlab/R2022a

matlab -nodisplay -nosplash -r "cd('/path/to/script/');scriptfile"

Later versions of matlab provide the '-batch' flag as an alternative.

module load matlab/R2022a

matlab -batch -r scriptfile