Skip Navigation

MATLAB

Skip Side Navigation

MATLAB

Table of Contents

What version of MATLAB is available on OSCER resources?

To find out which version of MATLAB is currently available on OSCER resources:

  • Log into the OSCER system
  • Type module avail MATLAB
  • You will get a result similar to this (with the version available at the time):

Click here to see all MATLAB components and toolboxes covered under OU's license.

Who can use MATLAB on OSCER resources?

The following users are allowed to access MATLAB on OSCER resources:

  • Active OU faculty/staff/students with valid OU Norman campus accounts are allowed use the OU-licensed MATLAB.
  • Visiting scholars/researchers/professors/affiliates/etc. also qualify to use MATLAB, as long as they have valid OU Norman campus accounts during their involvement with OU. However, they are restricted to using it for OU purposes only (basically, for the reasons why they are at OU).
  • Retirees are not eligible to use MATLAB.
Please Note: OU-licensed MATLAB can only be used for educational/classroom purposes and for academic research in which OU is directly involved. It cannot be used for commercial purposes (even by eligible OU users), nor for academic and research purposes at other institutions.

Getting access to use MATLAB on OSCER resources

Eligible users are granted access to MATLAB by placing them in a special group. Follow the steps below to see if you already have access to run MATLAB on OSCER resources:

  • Log into the OSCER system
  • Type id
  • If you find matlab under groups, you are already able to run MATLAB
  • If you do not find matlab under groups, please contact us at support@oscer.ou.edu to request access to MATLAB. Please note that we will have to verify your eligibility before granting access.

Using MATLAB Interactively is FORBIDDEN

Running interactively on the login nodes could negatively impact performance for other users. You are FORBIDDEN to use MATLAB interactively. This means you are not allowed to type matlab at the Unix command prompt. Instead, ALL MATLAB runs MUST be performed via the batch scheduler. We will cancel jobs running interactively on the login nodes if we determine they are causing performance issues.

Click here to learn the basics of submitting jobs on Schooner.

Sample Code

Step 1: Create a sample Matlab file called matlab_test.m and insert the following lines of code:

echo on;
colormap(hsv);
x = zeros(32);
x(13:20,13:20) = ones(8);
mesh(x);
y = fft2(x);
z = real(sqrt(y.^2));
w = fftshift(z);
surf(w);
grid;
echo off;
print -dpdf matlab_test_output.pdf;
quit;

Step 2: Create a batch submission file called matlab_batch.sh and insert the following lines of code:

#!/bin/bash
#
#SBATCH --partition=normal
#SBATCH --job-name=matlab_test
#SBATCH --output=matlab_output_%J.txt
#SBATCH --error=matlab_error_%J.txt
#SBATCH --time=12:00:00
#SBATCH --nodes=1
#SBATCH --ntasks=1
#SBATCH --mem=1024M

module load MATLAB/2020a
matlab -nodisplay -r matlab_test

This assumes a single-threaded matlab process. If your matlab code can run multi-threaded, please request as many cores as you need with --ntasks=x instead of 1. If your code can run on all 20 or 24 cores of a node, please add "#SBATCH --exclusive" to the script above, to request the entire node, in order to avoid overloading a compute node.

Step 3: Submit the batch job by typing sbatch matlab_batch.sh

Step 4: Upon successful completion of the job, you will find three new files in your directory: matlab_output.txt, matlab_error.txt, and matlab_test_output.pdf.

Step 5: Transfer the matlab_test_output.pdf to your computer and open it (see Uploading & Downloading Files for instructions on transferring files). It should look like the image below.