In this tutorial we will walk through the steps required to install
and make sure everything works well. You will need:
- MATLAB (
xolotlwill not work on GNU Octave)
- An internet connection
Download xolotl here and drag the downloaded file (
xolotl.mltbx) onto your MATLAB workspace. MATLAB should automatically open a prompt asking you if you want to install it.
Then we need to install a C/C++ compiler, and get MATLAB to work with that. Follow these instructions based on your operating system:
Installing on macOS
- Install XCode
- Open XCode, and accept the license agreement.
Installing on Windows
- Download and install the MinGW compiler from the Mathworks FileExchange. You'll need to log in using a Mathworks account. This ridiculous restriction is Mathworks' fault.
You can also get the compiler as a MATLAB "add-on."
Installing on GNU/Linux
- Use your favorite package manager to install a C and C++ compiler. For example, on Debian-based systems, use
sudo apt install gcc & sudo apt install g++
- Verify that your compiler is on the MATLAB path by running
system('which gcc')from within MATLAB
Configure MATLAB to use compilers
Run this in your MATLAB terminal:
mex -setup c++ mex -setup c
You should see something like this:
% This is what you'll see on macOS. The precise message % may be different on other operating systems MEX configured to use 'Xcode Clang++' for C++ language compilation. MEX configured to use 'Xcode with Clang' for C language compilation.
Verify your installation
OK, let's make sure everything works. Copy and paste the following code into your MATLAB terminal:
You should see this plot appear:
If you don't see this plot, or see some horrible error message, click on this link so we can figure out what went wrong