Matlab R2016a on Linux

May 05, 2016

Matlab R2016a on Linux seems to have some trouble. The issue is reported here.

It seems to have something to do with opening new windows.

inputdlg()

For reference, I run Matlab in Fedora 23 x64 bit, with an Intel(R) Core(TM) i5-3570K processor and no other graphics card.

Fedora 24

Fedora 24 has upgraded to ncurses6. Matlab expects ncurses5. As documented here, you need to install ncurses-compat-libs to get things working.

sudo dnf install ncurses-compat-libs

OpenGL rendering

The issue seems to be associated with OpenGL rendering. You can try to see if enabling software rendering helps you. In a terminal, run the following command:

/usr/local/MATLAB/R2016a/bin/matlab -softwareopengl

Now try to run

inputdlg()

or

plot(1:10)

If that fixes things, we can work to make this change more permanent.

Permanently enabling software OpenGL

To permanently enable software OpenGL without modifying your other scripts, we will create a new Matlab script in the R2016a directory instead of modifying our other launchers. This has the advantage that when 2016b comes out, our hack will probably be obsolete and removed automatically.

I assume you are running all commands as root. You can change to root with the sudo -i command.

To do this, move the old Matlab launcher

cd /usr/local/MATLAB/R2016a/bin
mv matlab matlab_actual

Now create a new file called matlab with the following content

#!/bin/sh

/usr/local/MATLAB/R2016a/bin/matlab_actual -softwareopengl "$@"

Make sure "$@" and not just $@ as explained here.

Now make sure the new file is executable

chmod 755 matlab

Done!

Installing matlab in system directories

If you haven’t done so, you can install Matlab in a system directory so that you can launch it by just typing matlab. To do so run the following command

sudo ln -s /usr/local/MATLAB/R2016a/bin/matlab /usr/local/bin/.

Getting rid of specific notifications

Matlab probably doesn’t want you to do this, but getting a notification that you have an academic license, or any type of license every time is a little annoying.

You can remove the notification by modifying the file /usr/local/MATLAB/R2016a/resources/MATLAB/en/branding.xml. Of course, you should change en to the language you are using for Matlab.

Within the file, find the entries

I would keep the other entries as is. They aren’t as intrusive. Of course, if you have an other type of license, you can change the appropriate string.