MATLAB¶
MATLAB is a highlevel language and interactive environment that enables you to perform computationally intensive tasks faster than with traditional programming languages.

Create a MATLAB Script
First, you need to create a MATLAB script (a .m file) using any text editor. For this tutorial, we'll create a file named
myscript.m
:myscript.m% MATLAB Script disp('Hello, World!') x = 5; y = 6; disp(x*y)

Submit your MATLAB job
Create your submission script:
matlabslurm.sh#!/bin/bash #SBATCH J matlab # job name #SBATCH o log_slurm.o%j # output and error file name (%j expands to jobID) #SBATCH n 1 # total number of tasks requested #SBATCH N 1 # number of nodes you want to run on #SBATCH cpuspertask 1 #SBATCH p bsudfq # queue (partition) #SBATCH t 12:00:00 # run time (hh:mm:ss) # Load the MATLAB module module load matlab # Run the script matlab nodisplay nosplash nodesktop r "run('myscript.m'); exit;"
And submit this script using
sbatch matlabslurm.sh

Check Output
The output of the above job will be saved to a file called
log_slurm.o######
where######
is replaced with the slurm job id. You should see something like the following in the output:Hello, World! 30
Using MATLAB in OnDemand¶
Currently OnDemand is available for Borah https://borahondemand.boisestate.edu After opening the terminal application on the desktop, here is an example of the commands to open MATLAB:
module load matlab
matlab
Resources¶
 MATLAB Documentation: Official documentaion
 MATLAB Central: Forum to ask questions and learn from other MATLAB users and experts.
 MATLAB Onramp: A free twohour introductory tutorial that allows you to learn and practice using MATLAB interactively.
 MATLAB Examples: A collection of code examples for a variety of MATLAB functions.