MATLAB® is a programming platform designed specifically for engineers and scientists. The heart of MATLAB is the MATLAB language, a matrix-based language allowing the most natural expression of computational mathematics.  UEA has a site licence, and you can run multiple instances on the cluster.

What can you do with MATLAB?

Using MATLAB, you can:

  • Analyze data
  • Develop algorithms
  • Create models and applications

The language, apps, and built-in math functions enable you to quickly explore multiple approaches to arrive at a solution. MATLAB lets you take your ideas from research to production by deploying to enterprise applications and embedded devices, as well as integrating with Simulink® and Model-Based Design.

There are lots of examples and tutorials on the matlab site.

Using Matlab on ADA

There are two ways of working with matlab on ADA - interactive and batch mode.

Interactive session

Best used for testing out scripts and for jobs that require visualisation.  If you need to do intensive visualisation, you should look at our visualistaion service.

  • start an interactive session
  • in the window (note the prompt will have changed to show the node name) type
            module add matlab
  • type matlab &
  • then run whatever you want in matlab (using matlab help as appropriate)

Batch jobs

  • write a submit script similar to this example job script  (eg matlab-test.sub):
     

#!/bin/bash
# Mail events (NONE, BEGIN, END, FAIL, ALL)#SBATCH --mail-type=END,FAIL   
# Where to send mail#SBATCH --mail-user=<username>@uea.ac.uk    
#SBATCH -p compute             # Select compute queue
#SBATCH -t 36:00:00             # Set time limit to 36 hours
#SBATCH --job-name=matlab-test_job      # Set job name
#SBATCH -o matlab-test-%j.out               # Write job output to MatJob-(job_number).out
#SBATCH -e matlab-test-%j.err               # Write job error to MatJob-(job_number).err
#set up environment
module add matlab/2018a
#run the application
matlab -nodisplay -nojvm -nodesktop -nosplash -r my_matlab_m_file

 

  • at the bottom of that script there is a line that runs your matlab commands.  You can put all your matlab commands that you would type in an interactive session in a script - in the example called my_matlab_m_file
    Matlab scripts - see https://www.mathworks.com/help/matlab/matlab_prog/create-scripts.html
  • submit the script using sbatch matlab-submit-script-name   (eg matlab-test.sub)

Useful links

If you don't know how to edit files on Ada - have a look at https://rscs.uea.ac.uk/ada/using-ada/editing-files

You might also find https://rscs.uea.ac.uk/ada/using-ada/new-to-linux useful if you aren't used to using the command line.