MATLAB is a computing and programming language platform used to create and develop algorithms and analyze data. In this article, we will learn how to install MATLAB on Ubuntu 22.04.
In order to download MATLAB, you must have a MATHWORKS account. If you don’t have it, go to the MATLAB website and create one.
Once your account is created, head to the Products section and click on Get MATLAB.
In the next page, click on Install MATLAB.
Then proceed to download MATLAB.
Alternativelly, if it makes it any easier for you, we can share the downloads page where you can download the installer directly, without following the steps mentioned above.
Preparing for Installation
Before proceeding with the steps to install MATLAB, we’re required to have a few things ready.
We need a file extractor and for the purpose of this article, we will use unzip. If you don’t have it installed, proceed to execute the following command:
$ sudo apt install unzip
We will also need a directory where we will extract the contents of the MATLAB archive:
$ cd ~/Downloads $ mkdir matlab
We will create a destination directory for the installation:
$ sudo mkdir -p /usr/local/MATLAB/R2022b/
Now, we go to the directory where we downloaded the installer, in order to extract it:
$ cd ~/Downloads $ unzip matlab_R2022b_glnxa64.zip -d matlab
Next, head to the matlab directory, and then execute the installer.
$ cd matlab $ sudo ./install
Installing MATLAB on Ubuntu
Step 1. Once we run the matlab installer, a login window will appear on the screen. Enter your name and username and then click on Sign In.
Step 2. Accept the terms of license agreement then click next.
Step 3. In the next window, activate or not, the activation key of your product.
Step 4. Next, confirm your user (use the account name on your system).
Step 5. Select the destination directory, which we already created, where the application will be installed.
Step 6. Select the tools you need to use within the application.
Step 7. Create a symlink for MATLAB scripts.
Step 8. And finally, a complete summary of information will be displayed in the window, which will be used to install the application. Click on Begin Install.
And that’s it. If you want to start the application from the terminal, you can execute the following command:
$ matlab &
Creating a MATLAB Shortcut
I like to keep my desktop very nice and tidy but in case you want to create a shortcut, just follow these very simple steps:
Step 1. Create the shortcut path.
$ nano ~/Desktop/Matlab.desktop
Step 2. Copy and paste the next entry. Once done, use ‘ctrl + x’ to close it and then hit ‘y’ to confirm the changes.
[Desktop Entry] Version=1.0 Type=Application Name=MATLAB Exec=/usr/local/MATLAB/R2022b/bin/matlab -desktop Icon=/usr/local/MATLAB/R2022b/resources/coreui/matlab/splash.png Terminal=false
Step 3. Finally, on your dekstop, right click on the MATLAB icon, and select ‘Allow Launching’.
Removing MATLAB from Ubuntu
If for any reason you didn’t like MATLAB, you can remove it following the next commands:
$ sudo rm -r /usr/local/bin/matlab $ sudo rm -r /usr/local/MATLAB