How to install MATLAB in Ubuntu 20.04

MATLAB from Mathworks is a platform-independent software for solving mathematical problems and graphically displaying the results. The software package is best-known for tools for calculating and simulating complex mathematical and technical problems. Here we learn the steps to install MATLAB on Ubuntu Linux and how to create its Desktop shortcut…  

In addition to the basic module, a whole range of extensions for MATLAB is available, which is known as Toolbox. This includes Simulink, a graphical user interface block-oriented development platform for the modeling, simulation, and analysis of dynamic, non-linear, and event-driven systems, that can be used to model and simulate systems interactively.

This programming platform is used for a wide range of tasks in industry and at universities, especially in control engineering and technical mechanics. It offers comprehensive functionality for mathematical calculations and visualization as well as a powerful programming language.

The functionality of MATLAB can be used in two ways: one is by using an interactive calculation and simulation environment and the other by calling self-written MATLAB functions that use the numerical methods of MATLAB.

When it comes to numerical procedures, this platform offers almost everything such as solving linear systems of equations, calculating zeros for any functions, numerical integration, and more.

The thing is to be noted, MATLAB is a paid application and available to easily install for Windows 7 or 10, macOS, and Linux. And here we let you know the steps to be used for Linux such as Ubuntu.

Steps to Install MATLAB for Ubuntu 20.04 Linux.

The steps given here will not only applicable for Ubuntu 20.04 LTS but also work for Ubuntu 21.04 and 18.04 including Debian, Linux Mint, MX Linux, Zorin OS, Elementary OS, Deepin, CentOS, OpenSUSE, Kali, RHEL, and other Linux distros.

1. Download MATLAB R2020b Linux version

While writing this tutorial, the latest version of Matlab available to download was R2020b, however, that doesn’t mean the process of its installation will be changed, if you are one some other latest version.

  1. Open the browser and go to www.mathworks.com
  2. Click the download button for the current release
  3. Enter your email ID to Sign in, if you don’t have an account with MathWorks, then simply Sign up for it.
  4. Select between two options Get Trail or Link your licenses. Click on the Get Trail button, you can link your license, if you have, later otherwise continue using the trial version until it gets expired.
  5. Download the installer for Linux.

 

2. Extract Zip file

The MATLAB Linux installer will be in zip format, thus to get started with its installer, first we need to unzip the same.

  1. Open the Command terminal
  2. Switch to the Downloads directory because the files we download from the browser automatically go to that. Here is the command: cd Downloads
  3. Check the availability of files- ls
  4. Installer Unzipsudo apt install unzip
  5. Create a folder to extract files- mkdir matlab
  6. Unzip the MATLAB file- unzip -qq matlab*.zip -d matlab

3. Run MATLAB Linux Installer on Ubuntu 20.04

Once the extraction of the zipped file has been completed, the next step is to run the installer that will offer a graphical user interface installation wizard.

Switch to the directory we have created to extract MATLAB files:

cd matlab

Now, display all files, inside it:

ls

Run installer

sudo ./install

 

4. Login with MathWorks Account

Enter your Mathworks Account email address and password to use the corresponding available License information.

Enter Email Address of MathWorks account min

 

5. Select the available License

As we are using the Trail version, the license available corresponding to it will show there. If you have purchased one that will also appear in the “Select License” area. Alternatively, we can also enter the Activation key manually.

Matlab License min

 

6. Select Matlab Products or Toolbox to install

All the Toolbox packages will appear, by default, all will be marked to install, if you want some particular Toolbox then choose that only and uncheck the others.

Select MATLAB R2020b all products and tools to install min

 

7. Select Destination address

Leave the default folder as it is unless you don’t want it to some other place and then select the NEXT button.

Set destination folder min

 

8. Create MATLAB Symbolic link

To run the MATLAB directly using the Command line terminal, we have to create a Symbolic for its script. For that check the box available for it.

Note: In case you forget to check this option then we can create a symbolic link after the MATLAB installation using the following commands:

sudo ln -s /<path-to-your-matlab>/matlab /usr/local/bin/matlab

If you have followed the above steps then it will be like this:

sudo ln -s /usr/local/MATLAB/R2020b/bin/matlab /usr/local/bin/matlab

 

Create a Symbolic link for Matlab min

Begin Mathwork instalaltion process 1 min Download Matlab Toolbox files online min

 

9. Start the application

Once the installation is completed, to start the MATLAB software, on your command terminal type:

matlab

Install and run MATLAB on Ubuntu 20.04 Linux min

 

10. Create Matlab Desktop Shortcut Linux

If you are on Ubuntu or using some other Linus Distro and want to create a MATLAB desktop shortcut icon to easily run it. Then follow the below steps:

1. Open a command terminal

2. Create a Desktop Shortcut file for MATLAB using the command:

nano ~/Desktop/Matlab.desktop

3. Copy-paste the below lines

[Desktop Entry]
Version=1.0
Type=Application
Name=MATLAB
Exec=/usr/local/MATLAB/R2020b/bin/./matlab
Icon=/usr/local/MATLAB/R2020b/resources/coreui/matlab/splash.png
Terminal=false

Note: Change Exec Path, in case you have installed Matlab in some other directory apart from the default one showing in the above-given lines.

4. Save the Desktop Shortcut file by pressing Ctr+X and the type Y followed by the Enter Key.

5. Now, go to the Desktop, right-click on the created file and select the “Allow Launching” option.

Make the Shortuct icon Executable on Ubuntu min

6. Double click on the Ubuntu MATLAB desktop shortcut to start the application. 

MATLAB Desktop shortcut icon Linux Ubuntu min

 

11. Uninstall

To remove the installation of Matlab, we just need to delete its folder and Syslink created by it. Here we are using the default path suggested by the software to install it, thus we are using that with the remove command. If you have used any custom directory then use the path of the same:

sudo rm -r /usr/local/bin/matlab
sudo rm -r /usr/local/MATLAB

 

Other Articles:

 

13 thoughts on “How to install MATLAB in Ubuntu 20.04”

  1. I followed the instruction and command you have given
    after i given sudo ./install
    then I don’t got that Matlab installation window and terminal also not get terminated what should i do?

    Reply
  2. Hola
    I’ve gotten the installer window, but the installer states that it doesn’t have write permissions for the /usr/local/MATLAB/2021b directory. How should I tell the system to give it those permissions?
    Thanks,
    David

    Reply
  3. Hello,

    After unpacking as instructed, I still have the following error:
    I have tried both sudo ./install and without the sudo. I also tried “xhost +SI:localuser:root” which shows the matlab icon in the sidebar but the window does not open.

    Reply
  4. Hi, actually I was trying to do what the turorial explains. In particular, with the desktop shortcut, in my case it does not work like it is written. In particular, I have ubuntu 20.04 and I have matlab 2022a installed. So, in order to make the shortcut works properly I used the following lines to fill the file Matlab.desktop

    [Desktop Entry]
    Version=1.0
    Type=Application
    Name=MATLAB
    Exec=/usr/local/MATLAB/R2022a/bin/matlab -desktop
    Icon=/usr/local/MATLAB/R2022a/resources/coreui/matlab/splash.png
    Terminal=false

    NOTE that in particular the problem was with the EXEC LINE. I needed to remove ./matlab and use the all path and also added the option -desktop that is also important. Otherwise, I was not able to launch the interface.

    Hopefully it helps someone 🙂

    Reply
  5. Hello, if sudo ./install is not working then try to giving permission to matlab_* folder using $ sudo chmod -R 777

    Then try change to root user and after that try sudo ./install

    Reply

Leave a Comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.