Difference between revisions of "Matlab"
(→Troubleshooting) 
(→Troubleshooting: Add workaround for some dropdown menus) 

(133 intermediate revisions by 40 users not shown)  
Line 1:  Line 1:  
[[Category:Mathematics and science]]  [[Category:Mathematics and science]]  
−  {{  +  [[ja:Matlab]] 
+  {{Related articles start}}  
+  {{RelatedOctave}}  
+  {{RelatedSagemathematics}}  
+  {{RelatedMathematica}}  
+  {{Related articles end}}  
+  {{Poor writingunnecessarily verbose}}  
+  From the [http://www.mathworks.com/products/matlab/ official website]:  
−  +  :''MATLAB is a highlevel language and interactive environment for numerical computation, visualization, and programming. Using MATLAB, you can analyze data, develop algorithms, and create models and applications. The language, tools, and builtin math functions enable you to explore multiple approaches and reach a solution faster than with spreadsheets or traditional programming languages, such as C/C++ or Java.''  
−  
−  
−  
−  
−  
−  
−  +  == Overview ==  
+  
+  MATLAB is proprietary software produced by The MathWorks and requires a license to obtain, install, and activate. New versions of MATLAB are released twice a year,  
+  release names are composed of {{icR}}, the year of the release and {{ica}} or {{icb}}.  
+  Since R2012b MATLAB has only been available for 64bit Linux. Arch Linux is not officially supported.  
+  [http://www.mathworks.co.uk/support/sysreq/current_release/index.html]  
+  
+  == Installation ==  
+  
+  A complete copy of the MATLAB software must be obtained before it can be installed. The MATLAB software is available to licenses holders on both a DVD and through the [http://www.mathworks.com The MathWorks website]. In addition to the software a file installation key is required for installation. It is possible to install MATLAB either with the {{aurmatlab}} package from the [[AUR]] or from the MATLAB installation software directly. The advantage of the {{aurmatlab}} package is that it manages dependencies and some of the nuances of the installation process while installing directly from the MATLAB installation software can be done by regular users to their home directories and works for any release of MATLAB (the {{aurmatlab}} package only works for releases including and after R2010b).  
+  
+  === Installing from the MATLAB installation software ===  
+  
+  The MATLAB installation software is self contained and does not require any additional packages to install in silent mode. To install with the GUI a working [[Xorg]] graphical display is necessary. The installation is handled by the {{icinstall}} script. You can run the script as root to install MATLAB systemwide or your user to install it only for you.  
+  
+  MATLAB 2016a and earlier is not compatible with {{Pkgncurses}} 6, so you must install the {{AURncurses5compatlibs}} package. See [[#Segmentation Fault on startup]] for more info.  
+  
+  During the installation, you are asked if you want symlinks to be created. If you did not choose to do so, you can now manually create a symlink in {{ic/usr/local/bin}} to make it easier to launch in terminal:  
−  
−  
−  
# ln s /{MATLAB}/bin/matlab /usr/local/bin  # ln s /{MATLAB}/bin/matlab /usr/local/bin  
−  To  +  ==== Desktop entry ==== 
−  +  
−  +  Optionally create a [[desktop entry]]. The MIME type of MATLAB files is {{ictext/xmatlab}}.  
+  
+  Start {{icmatlab}} with:  
+  
+  * {{icdesktop}} to run Matlab without a terminal.  
+  * {{icnosplash}} to prevent the splash screen from showing up.  
+  
+  In order for icons to appear correctly {{icStartupWMClass}} needs to be set in the desktop entry. To find it out start MATLAB, run {{icxprop {{!}} grep WM_CLASS}} and select the MATLAB window.  
+  
+  === Installing from the AUR package ===  
+  
+  The EULA for the proprietary MATLAB software is restrictive. The {{aurmatlab}} package from the [[AUR]] is designed to allow MATLAB to be integrated into and managed by Arch. The package should be built on the system on which it is going to be installed and the package should be deleted from the installation location and the [[Pacman]] cache following installation. Distributing the package is a clear violation of the EULA.  
+  
+  The {{aurmatlab}} package from the [[AUR]] defaults to building a package for the most recent 64bit release of MATLAB, although the PKGBUILD supports MATLAB releases from R2010b and even the installation of multiple releases simultaneous. The PKGBUILD defaults to installing all toolboxes that the file identification key allows, however, the PKGBUILD can be edited to include only a subset of the toolboxes. The selection of the toolboxes must be finalized at the time of package creation due to DRM policies put in place by The MathWorks. The {{aurmatlab}} package from the [[AUR]] requires that both the MATLAB installation software and the file installation key are available in the source directory. The file installation key must be in a file called {{icmatlab.fik}} and the installation software must be in an iso file called {{icmatlab.iso}}. Once the iso file and file installation key are created, the MATLAB package can be created and install as usual.  
+  
+  For MATLAB releases between r2010b and r2011a the contents of the iso file must include: {{ic./archives/}}, {{ic./bin/}}, {{ic./etc/}}, {{ic./help/}}, {{ic./java/}}, {{ic./activate.ini}}, {{ic./install}}, and {{ic./installer_input.txt}}. If the MATLAB download agent is used to download the installation software, then the iso file can be trivially created by simply running {{icmkisofs r o}} on the download directory.  
+  
+  For MATLAB releases including and after r2011b the contents of the iso file must include: {{ic./archives/}}, {{ic./bin/}}, {{ic./etc/}}, {{ic./help/}}, {{ic./java/}}, {{ic./activate.ini}}, {{ic./install}}, and {{ic./installer_input.txt}}. For version before r2014a, the MATLAB download agent could download all the required files and the iso file could be trivially created by simply running {{icmkisofs r o}} on the download directory. For MATLAB releases including and after r2014a the MATLAB download agent only downloads the MATLAB installer. The MATLAB installer then needs to be run to downloaded the MATLAB software and toolboxes. Therefore, a two step process is required to generate this iso file with the MATLAB download agent. First, you download and run the MATLAB installer to install MATLAB in a temporary directory. This process downloads the MATLAB software and toolboxes by default to {{ic~/Downloads/MathWorks}} (this can be changed by passing the flag {{icdownloadFolder /path/to/directory}}). It is actually possible quit the MATLAB installer once the software and toolboxes are downloaded. Once the software and toolboxes are downloaded the required iso file can be created by merging the installer directory (containing above mentioned files) and the download directory (containing {{ic./archives/}}), and then running {{icmkisofs r o}} on the resulting directory.  
+  
+  == Activation ==  
+  
+  In order to run MATLAB it requires a license file to be installed. The license file can be generated with {{ic$MATLABROOT/bin/activate_matlab.sh}} or downloaded from [http://www.mathworks.com MATLAB] directly.  
+  
+  === R2013b and earlier ===  
+  {{RemoveR2013b is quite old.}}  
+  Up to and including R2013b the license file was linked to the MAC address of eth0. This causes problems with the [[Network_configuration#Device_namesPredictable Network Interface Names]] used by Arch Linux. It is possible to disable predictable network interface names by adding {{ic1=net.ifnames=0}} in your kernel command line or by creating a udev rule file  
+  
+  # ln s /dev/null /etc/udev/rules.d/80netsetuplink.rules  
+  
+  It is also possible to [[Network_configuration#Change_device_namechange the name of a device]], but changing the name to eth0 can result in race conditions between the kernel and udev during boot. Another solution is to create a dummy network interface named eth0 with the MAC address linked to the license file. First, get that MAC address using {{icip link}}. Next, create the following file:  
+  
+  {{hc/etc/systemd/system/matlab.licensing.service<nowiki>  
+  [Unit]  
+  Description=Dummy network interface for MATLAB  
+  Requires=systemdmodulesload.service  
+  
+  [Service]  
+  Type=oneshot  
+  ExecStart=/sbin/ip link set dev dummy0 name eth0  
+  ExecStart=/sbin/ip link set dev eth0 address 00:00:00:00:00:00  
+  
+  [Install]  
+  WantedBy=multiuser.target  
+  </nowiki>}}  
+  
+  Replace 00:00:00:00:00:00 with the MAC address linked to the license file.  
+  
+  Then make the script run on boot:  
+  
+  # systemctl enable matlab.licensing  
+  
+  Finally, set the dummy module to load on boot by creating the following file:  
+  
+  {{hc/etc/modulesload.d/dummy.conf<nowiki>dummy</nowiki>}}  
+  
+  == Configuration ==  
+  
+  === Java ===  
+  
+  The MATLAB software is bundled with a JVM and therefore it is not necessary to install [[Java]]. The JVM version bundled with MATLAB typically lags behind {{pkgjre7openjdk}} from the [[official repositories]] and it is possible, although not required, to use the {{icMATLAB_JAVA}} environment variable to specify the path of an alternative JRE. For example, to specify the {{pkgjre7openjdk}} JRE and check the resulting version of Java, do:  
+  
+  $ MATLAB_JAVA=/usr/lib/jvm/java7openjdk/jre matlab nodesktop nosplash r "version java, exit"  grep Java  
+  
+  {{Accuracyoverly specific, yet no references to claimed behaviour}}  
−  +  Using alternative JRE would often solve some longstanding problems, such as the extra "{{icMEvent. CASE!}}" string when doing twofinger scrolling using touchpad. Another problem that can be solved in this way is the ugly, limited fonts provided by default, especially for some Chinese characters.  
−  +  === OpenGL acceleration ===  
−  
−  
−  
−  
−  
−  
−  
−  
−  
−  
−  +  MATLAB can take advantage of hardware based 2D and 3D OpenGL acceleration. Support for hardware acceleration needs to be configured outside of MATLAB. Appropriate [[video drivers]] need to be installed along with the OpenGL utility library {{Pkgglu}} package. If X11 forwarding is being used, the video drivers need to be installed on both the client and server. To check if MATLAB is making use of hardware based OpenGL acceleration run:  
−  +  $ matlab nodesktop nosplash r "opengl info; exit"  grep Software  
−  +  If "software rendering" is not "false", then there is a problem with your hardware acceleration. If this is the case make sure OpenGL is configured correctly on the system. This can be done with the {{icglxinfo}} program from the {{Pkgmesademos}} package:  
−  
−  
−  
−  +  $ glxinfo  grep "direct rendering"  
−  +  If "direct rendering" is not "yes", then there is likely a problem with your system configuration.  
−  +  If glxinfo works but not matlab, you can try to run:  
+  $ export LD_PRELOAD=/usr/lib/libstdc++.so; export LD_LIBRARY_PATH=/usr/lib/xorg/modules/dri/; matlab nodesktop nosplash r "opengl info; exit"  grep Software  
−  +  If its works, you can edit Matlab launcher script to add:  
−  
−  +  export LD_PRELOAD=/usr/lib/libstdc++.so  
+  export LD_LIBRARY_PATH=/usr/lib/xorg/modules/dri/  
−  +  === Fonts for figures ===  
−  +  {{Note This section only applies to R2014a and earlier as starting with R2014b MATLAB uses True Type Fonts. So as long as {{icfcmatch Helvetica}} returns a font, figure fonts should work as expected.}}  
−  
−  +  While MATLAB can be run in a text only mode, it also provides advanced graphics capabilities. To confirm that MATLAB is making use of the system fonts run:  
−  +  $ matlab nodesktop nosplash r "xlabel('BIG FONT', 'FontSize', 42); ylabel('small font', 'FontSize', 12); pause; exit" > /dev/null  
−  +  This should produce a MATLAB figure with "BIG FONT" in a large font on the abscissa and "small font" in a small font on the ordinate. If "BIG FONT" and "small font" are both the same size, refer to [[Xorg#Program_requests_.22font_.27.28null.29.27.22Xorg fonts]] to confirm that the correct the bitmap font package (either {{Pkgxorgfonts100dpi}} or {{Pkgxorgfonts75dpi}} from the [[official repositories]]) is installed on your system.  
−  +  === Sound ===  
−  +  To confirm that MATLAB is able to use the default soundcard to present sounds run:  
−  +  $ matlab nodesktop nosplash r "load handel; sound(y, Fs); pause(length(y)/Fs); exit" > /dev/null  
−  +  This should play an except from Handel's "Hallelujah Chorus." If this fails make sure [[ALSA]] is properly configured. This can be done with the {{icspeakertest}} program from the {{Pkgalsautils}} package from the [[official repositories]]:  
−  $  +  $ speakertest 
−  +  If you do not hear anything, then there is likely a problem with your system configuration.  
−  ===  +  === GPU computing === 
−  In order  +  MATLAB can take advantage of [http://www.mathworks.co.uk/discovery/matlabgpu.html CUDA enabled GPUs] to speed up applications. In order to take advantage of a supported GPU install the {{Pkgnvidia}}, {{Pkgnvidiautils}}, {{Pkgoclicd}}, {{Pkgopenclnvidia}}, and {{Pkgcuda}} packages from the [[official repositories]]. To check if MATLAB is able to utilize the GPU run: 
−  +  $ matlab nodesktop nosplash r "x=rand(10, 'single'); g=gpuArray(x); Success=isequal(gather(g), x), exit"  sed ne '/Success =/,$p'  
−  
−  
−  ==  +  === Install supported compilers === 
−  
−  +  In order to access the full functionality of MATLAB (e.g., to use Simulink, Builder JA, and MEXfile compilation), supported versions of the {{icgcc}}, {{icg++}}, {{icgfortran}}, and {{icjdk}} compilers must be installed. Details about the supported compilers for the [http://www.mathworks.com/support/compilers/current_release/index.html?sec=glnxa64 current release] and [http://www.mathworks.com/support/sysreq/previous_releases.html previous releases] are available online. Many of the supported {{icgcc}}, {{icg++}}, {{icjdk}} compiler versions for past MATLAB releases are available from the [[AUR]] (e.g., {{AURgcc43}}, {{AURgcc44}}, {{AURgcc47}}, {{AURgcc49}}and {{AURjdk6}}), while past versions of the {{icgfortran}} compilers are not packaged.  
−  
−  +  To use previous versions of the the {{icgcc}}, {{icg++}}, and {{icgfortran}} compilers with MEX files, edit {{ic${MATLAB}/bin/mexopts.sh}} and replace all occurrences of {{ic<nowiki>CC='gcc'</nowiki>}} with {{ic<nowiki>CC='gcc4.X'</nowiki>}}, {{ic<nowiki>CXX='g++'</nowiki>}} with {{ic<nowiki>CXX='g++4.X'</nowiki>}}, and {{ic<nowiki>FC='gfortran'</nowiki>}} with {{ic<nowiki>FC='gfortran4.X'</nowiki>}}, where {{icX}} is the compiler version appropriate for the particular MATLAB release.  
−  
−  
−  
−  +  === Help browser ===  
−  
−  The  +  The help browser uses valuable slots in the dynamic thread vector and causes competition with core functionality provided by libraries like the BLAS that also depend on the dynamic thread vector. The help browser can be configured to use fewer slots in the dynamic thread vector with 
−  +  >> webutils.htmlrenderer('basic');  
−  +  This is a persistent change and to reverse it use  
−  +  >> webutils.htmlrenderer('default');  
−  +  === Garbled Interface ===  
+  export J2D_D3D=false  
export MATLAB_JAVA=/usr/lib/jvm/java7openjdk/jre  export MATLAB_JAVA=/usr/lib/jvm/java7openjdk/jre  
−  ==== MATLAB crashes when displaying graphics  +  == Troubleshooting == 
+  
+  === Static TLS errors ===  
+  
+  MATLAB has a number of libraries that have been compiled with static thread local storage (TLS) including the help broswer {{icdoc}} and the BLAS libraries. For example,  
+  
+  >> doc('help');  
+  >> ones(10)*randn(10);  
+  Error using *  
+  BLAS loading error:  
+  dlopen: cannot load any more object with static TLS  
+  
+  is related to the bugs:  
+  
+  * [http://www.mathworks.de/support/bugreports/961964 961964] for which patched libraries are available from [http://www.mathworks.de/support/bugreports/license/accept_license/5730?fname=attachment_961964_12b_13a_13b_14a_glnxa64_20140130.zip&geck_id=961964 MathWorks]  
+  * [http://www.mathworks.com/support/bugreports/1003952 1003952] for which workarounds exist  
+  
+  A more general solution of recompiling {{icglibc}} has also been suggested. [http://stackoverflow.com/a/19468365/2787723]  
+  
+  === MATLAB crashes when displaying graphics ===  
To identify this error, start MATLAB with  To identify this error, start MATLAB with  
Line 130:  Line 207:  
sudo ln s /usr/lib/libstdc++.so.6  sudo ln s /usr/lib/libstdc++.so.6  
−  ==== Blank/grey UI when using DWM/Awesome ====  +  If MATLAB still crashes or corrupts graphics (during startup or when plotting), make sure Java's 2D OpenGL rendering is disabled. 
+  The environment variable {{ic_JAVA_OPTIONS}} should not contain {{ic1=Dsun.java2d.opengl=true}}.  
+  
+  === Blank/grey UI when using DWM/Awesome ===  
+  
+  [http://tools.suckless.org/wmname wmname] is a utility to set the window manager name of the root window.  
+  
+  wmname LG3D  
+  
+  Then start Matlab.  
+  
+  === Garbled or invisible text ===  
+  
+  Set the environment variable <code>J2D_D3D</code> to <code>false</code>[https://stackoverflow.com/questions/22737535/swingrenderingappearsbrokeninjdk18correctinjdk17].  
+  
+  In newer versions of MATLAB (R2015b) [https://www.reddit.com/r/archlinux/comments/3yaga8/matlab_installer_bonked/] this also requires setting <code>MATLAB_JAVA</code> to something openjdk based. Example:  
+  
+  export J2D_D3D=false  
+  ./bin/glnxa64/install_unix javadir /usr/lib/jvm/java7openjdk/jre  
+  
+  === Corrupted text and fonts in menus and fields ===  
+  If you notice that the menus or the input fields are corrupted or not appearing correctly then you can try to activate the ''"'''Use antialiasing to smooth desktop fonts'''"'' option in Matlab preferences, it seems to solve the problem. Go to '''''Preferences > Matlab > Fonts''''' and activate it. You will need to restart Matlab in order to take affect.  
−  +  === Installation ===  
+  As one installs Matlab, it might complain that it cannot find a package, for the most part just look at the package name and then install it with [[Pacman]], or in the case of x86_64 there are some libraries only in [[AUR]].  
−  ==  +  === Installtime library errors === 
+  * Make sure that the symlink {{icbin/glnx64/libstdc++.so.6}} is pointing to the correct version of {{iclibstdc++.so.xx}} (which is also in the same directory and has numbers where 'xx' is). By default, it may be pointing to an older (and nonexistent) version (different value for 'xx').  
−  +  * Make sure the device you're installing from is not mounted as {{icnoexec}}  
−  +  * If you downloaded the files from Mathworks' website, make sure they are not on an NTFS or FAT partition, because that can mess up the symlinks. Ext4 or Ext3 should work.  
−  +  === Resolving start warnings/errors ===  
−  {{  +  * Even if all needed libraries are installed, Matlab when starting can still report some missing libraries. This is resolved by symbolic linking of needed libraries to directories that Matlab checks at startup. For example, if Matlab triggers error/warning about missing {{ic/lib64/libc.so.6}} library, this can be resolved by: 
−  
−  
−  
−  
−  
−  
−  
−  +  # ln s /lib/libc.so.6 /lib64  
−  +  
−  +  * Matlab R2011b with an uptodate Arch Linux (as of March 12, 2012) fails on startup with the familiar "Failure loading desktop class." A solution is to point Matlab to the system JVM (confirmed to work with the {{Pkgjdk7openjdk}} package):  
−  +  
−  +  export MATLAB_JAVA=/usr/lib/jvm/java7openjdk/jre  
−  +  
−  +  === Segmentation fault on startup ===  
−  +  
+  If Matlab stops working after upgrading {{Pkgncurses}} to v6.x, [[install]] the {{AURncurses5compatlibs}} package. See [https://bbs.archlinux.org/viewtopic.php?id=202575 BBS#202575].  
+  
+  === Hangs on rendering or exiting with Intel graphics ===  
+  
+  Some users have reported issues with DRI3 enabled on Intel Graphics chips. A possible workaround is to disable DRI3 and run MATLAB with hardware rendering on DRI2; to do so, launch MATLAB with the environment variable LIBGL_DRI3_DISABLE set to 1:  
+  
+  LIBGL_DRI3_DISABLE=1 /{MATLAB}/bin/matlab  
+  
+  If the previous workaround does not work, the issue can be circumvented by selecting software rendering with the MATLAB command (beware, performance may be very poor when doing e.g. big or complex 3D plots):  
+  
+  opengl('save','software')  
+  
+  See [https://bugzilla.redhat.com/show_bug.cgi?id=1357571] and [https://bugs.freedesktop.org/show_bug.cgi?id=96671] for more.  
+  
+  === Addon manager not working ===  
+  Addon manager requires the {{AURlibselinux}} package to work. (in Matlab 2016b)  
+  
+  Since upgrade from pango1.40.5 to pango1.40.6, the MATLABWindow application (responsible for AddOn Manager, Simulation Data Inspector and perhaps something else) cannot be started. [https://bugs.archlinux.org/task/54257]  
+  A workaround is to point MATLAB shipping glib libraries to those glib libraries from your system. There are 5 of those libraries in {{icmatlabroot/R2017a/cefclient/sys/os/glnxa64}}, namely, as of R2017a:  
+  
+  libgio2.0.so  
+  libglib2.0.so  
+  libgmodule2.0.so  
+  libgobject2.0.so  
+  libgthread2.0.so  
+  
+  Make it so that these symlinks are pointing to your system glib libraries instead of versions located in {{icmatlabroot/R2017a/cefclient/sys/os/glnxa64}}.  
+  
+  === Using webcam/video device ===  
+  Make sure the correct support package addons are installed (webcam or OS Generic Video Interface for example). If running matlab as a user, make sure your user has write permissions to wherever the support packages are being downloaded and installed.  
+  
+  At least Matlab 2016b doesn't recognize webcams or imaq adapters correctly without gstreamer0.10. The gstreamer0.10 can be found in the aur and installed as a work around.  
+  
+  Since MATLAB R2017a, Image Acqusition Toolbox is using GStreamer library version 1.0. It previously used version 0.10.  
−  ===  +  === MATLAB hangs for several minutes when closing Help Browser === 
+  Since upgrade of glibc from 2.24 to 2.25, MATLAB (at least R2017a) hangs when closing Help Browser. The issue is related to the particular version of jxbrowserchromium shipped with MATLAB.  
−  +  To fix this issue, download the [https://www.teamdev.com/jxbrowser latest jxbrowser] and replace the following jars from MATLAB:  
−  
−  
−  
−  
−  
−  
−  
−  
−  
−  +  matlabroot/java/jarext/jxbrowserchromium/jxbrowserchromium.jar  
−  +  matlabroot/java/jarext/jxbrowserchromium/jxbrowserlinux64.jar  
−  
−  
−  
−  
−  
−  +  MATLAB should automatically unpack those jars into {{icmatlabroot/sys/jxbrowserchromium/glnxa64/chromium}} when first opening Help Browser.  
+  Remove {{icmatlabroot/sys/jxbrowserchromium/glnxa64/chromium}} directory to make sure MATLAB uses the latest jxbrowser.  
−  +  === Some dropdown menus cannot be selected ===  
+  In some interfaces  such as Simulation Data Inspector or Simulink Test Manager  nothing happens when choosing an item in dropdown menu (for example, when trying to change a number of subplots in Simulation Data Inspector). To work around this issue, hold down the Shift key while clicking the item in dropdown menu. 
Latest revision as of 11:45, 1 July 2017
Related articles
From the official website:
 MATLAB is a highlevel language and interactive environment for numerical computation, visualization, and programming. Using MATLAB, you can analyze data, develop algorithms, and create models and applications. The language, tools, and builtin math functions enable you to explore multiple approaches and reach a solution faster than with spreadsheets or traditional programming languages, such as C/C++ or Java.
Contents
 1 Overview
 2 Installation
 3 Activation
 4 Configuration
 5 Troubleshooting
 5.1 Static TLS errors
 5.2 MATLAB crashes when displaying graphics
 5.3 Blank/grey UI when using DWM/Awesome
 5.4 Garbled or invisible text
 5.5 Corrupted text and fonts in menus and fields
 5.6 Installation
 5.7 Installtime library errors
 5.8 Resolving start warnings/errors
 5.9 Segmentation fault on startup
 5.10 Hangs on rendering or exiting with Intel graphics
 5.11 Addon manager not working
 5.12 Using webcam/video device
 5.13 MATLAB hangs for several minutes when closing Help Browser
 5.14 Some dropdown menus cannot be selected
Overview
MATLAB is proprietary software produced by The MathWorks and requires a license to obtain, install, and activate. New versions of MATLAB are released twice a year,
release names are composed of R
, the year of the release and a
or b
.
Since R2012b MATLAB has only been available for 64bit Linux. Arch Linux is not officially supported.
[1]
Installation
A complete copy of the MATLAB software must be obtained before it can be installed. The MATLAB software is available to licenses holders on both a DVD and through the The MathWorks website. In addition to the software a file installation key is required for installation. It is possible to install MATLAB either with the matlab^{AUR} package from the AUR or from the MATLAB installation software directly. The advantage of the matlab^{AUR} package is that it manages dependencies and some of the nuances of the installation process while installing directly from the MATLAB installation software can be done by regular users to their home directories and works for any release of MATLAB (the matlab^{AUR} package only works for releases including and after R2010b).
Installing from the MATLAB installation software
The MATLAB installation software is self contained and does not require any additional packages to install in silent mode. To install with the GUI a working Xorg graphical display is necessary. The installation is handled by the install
script. You can run the script as root to install MATLAB systemwide or your user to install it only for you.
MATLAB 2016a and earlier is not compatible with ncurses 6, so you must install the ncurses5compatlibs^{AUR} package. See #Segmentation Fault on startup for more info.
During the installation, you are asked if you want symlinks to be created. If you did not choose to do so, you can now manually create a symlink in /usr/local/bin
to make it easier to launch in terminal:
# ln s /{MATLAB}/bin/matlab /usr/local/bin
Desktop entry
Optionally create a desktop entry. The MIME type of MATLAB files is text/xmatlab
.
Start matlab
with:

desktop
to run Matlab without a terminal. 
nosplash
to prevent the splash screen from showing up.
In order for icons to appear correctly StartupWMClass
needs to be set in the desktop entry. To find it out start MATLAB, run xprop  grep WM_CLASS
and select the MATLAB window.
Installing from the AUR package
The EULA for the proprietary MATLAB software is restrictive. The matlab^{AUR} package from the AUR is designed to allow MATLAB to be integrated into and managed by Arch. The package should be built on the system on which it is going to be installed and the package should be deleted from the installation location and the Pacman cache following installation. Distributing the package is a clear violation of the EULA.
The matlab^{AUR} package from the AUR defaults to building a package for the most recent 64bit release of MATLAB, although the PKGBUILD supports MATLAB releases from R2010b and even the installation of multiple releases simultaneous. The PKGBUILD defaults to installing all toolboxes that the file identification key allows, however, the PKGBUILD can be edited to include only a subset of the toolboxes. The selection of the toolboxes must be finalized at the time of package creation due to DRM policies put in place by The MathWorks. The matlab^{AUR} package from the AUR requires that both the MATLAB installation software and the file installation key are available in the source directory. The file installation key must be in a file called matlab.fik
and the installation software must be in an iso file called matlab.iso
. Once the iso file and file installation key are created, the MATLAB package can be created and install as usual.
For MATLAB releases between r2010b and r2011a the contents of the iso file must include: ./archives/
, ./bin/
, ./etc/
, ./help/
, ./java/
, ./activate.ini
, ./install
, and ./installer_input.txt
. If the MATLAB download agent is used to download the installation software, then the iso file can be trivially created by simply running mkisofs r o
on the download directory.
For MATLAB releases including and after r2011b the contents of the iso file must include: ./archives/
, ./bin/
, ./etc/
, ./help/
, ./java/
, ./activate.ini
, ./install
, and ./installer_input.txt
. For version before r2014a, the MATLAB download agent could download all the required files and the iso file could be trivially created by simply running mkisofs r o
on the download directory. For MATLAB releases including and after r2014a the MATLAB download agent only downloads the MATLAB installer. The MATLAB installer then needs to be run to downloaded the MATLAB software and toolboxes. Therefore, a two step process is required to generate this iso file with the MATLAB download agent. First, you download and run the MATLAB installer to install MATLAB in a temporary directory. This process downloads the MATLAB software and toolboxes by default to ~/Downloads/MathWorks
(this can be changed by passing the flag downloadFolder /path/to/directory
). It is actually possible quit the MATLAB installer once the software and toolboxes are downloaded. Once the software and toolboxes are downloaded the required iso file can be created by merging the installer directory (containing above mentioned files) and the download directory (containing ./archives/
), and then running mkisofs r o
on the resulting directory.
Activation
In order to run MATLAB it requires a license file to be installed. The license file can be generated with $MATLABROOT/bin/activate_matlab.sh
or downloaded from MATLAB directly.
R2013b and earlier
Up to and including R2013b the license file was linked to the MAC address of eth0. This causes problems with the Predictable Network Interface Names used by Arch Linux. It is possible to disable predictable network interface names by adding net.ifnames=0
in your kernel command line or by creating a udev rule file
# ln s /dev/null /etc/udev/rules.d/80netsetuplink.rules
It is also possible to change the name of a device, but changing the name to eth0 can result in race conditions between the kernel and udev during boot. Another solution is to create a dummy network interface named eth0 with the MAC address linked to the license file. First, get that MAC address using ip link
. Next, create the following file:
/etc/systemd/system/matlab.licensing.service
[Unit] Description=Dummy network interface for MATLAB Requires=systemdmodulesload.service [Service] Type=oneshot ExecStart=/sbin/ip link set dev dummy0 name eth0 ExecStart=/sbin/ip link set dev eth0 address 00:00:00:00:00:00 [Install] WantedBy=multiuser.target
Replace 00:00:00:00:00:00 with the MAC address linked to the license file.
Then make the script run on boot:
# systemctl enable matlab.licensing
Finally, set the dummy module to load on boot by creating the following file:
/etc/modulesload.d/dummy.conf
dummy
Configuration
Java
The MATLAB software is bundled with a JVM and therefore it is not necessary to install Java. The JVM version bundled with MATLAB typically lags behind jre7openjdk from the official repositories and it is possible, although not required, to use the MATLAB_JAVA
environment variable to specify the path of an alternative JRE. For example, to specify the jre7openjdk JRE and check the resulting version of Java, do:
$ MATLAB_JAVA=/usr/lib/jvm/java7openjdk/jre matlab nodesktop nosplash r "version java, exit"  grep Java
Using alternative JRE would often solve some longstanding problems, such as the extra "MEvent. CASE!
" string when doing twofinger scrolling using touchpad. Another problem that can be solved in this way is the ugly, limited fonts provided by default, especially for some Chinese characters.
OpenGL acceleration
MATLAB can take advantage of hardware based 2D and 3D OpenGL acceleration. Support for hardware acceleration needs to be configured outside of MATLAB. Appropriate video drivers need to be installed along with the OpenGL utility library glu package. If X11 forwarding is being used, the video drivers need to be installed on both the client and server. To check if MATLAB is making use of hardware based OpenGL acceleration run:
$ matlab nodesktop nosplash r "opengl info; exit"  grep Software
If "software rendering" is not "false", then there is a problem with your hardware acceleration. If this is the case make sure OpenGL is configured correctly on the system. This can be done with the glxinfo
program from the mesademos package:
$ glxinfo  grep "direct rendering"
If "direct rendering" is not "yes", then there is likely a problem with your system configuration.
If glxinfo works but not matlab, you can try to run:
$ export LD_PRELOAD=/usr/lib/libstdc++.so; export LD_LIBRARY_PATH=/usr/lib/xorg/modules/dri/; matlab nodesktop nosplash r "opengl info; exit"  grep Software
If its works, you can edit Matlab launcher script to add:
export LD_PRELOAD=/usr/lib/libstdc++.so export LD_LIBRARY_PATH=/usr/lib/xorg/modules/dri/
Fonts for figures
While MATLAB can be run in a text only mode, it also provides advanced graphics capabilities. To confirm that MATLAB is making use of the system fonts run:
$ matlab nodesktop nosplash r "xlabel('BIG FONT', 'FontSize', 42); ylabel('small font', 'FontSize', 12); pause; exit" > /dev/null
This should produce a MATLAB figure with "BIG FONT" in a large font on the abscissa and "small font" in a small font on the ordinate. If "BIG FONT" and "small font" are both the same size, refer to Xorg fonts to confirm that the correct the bitmap font package (either xorgfonts100dpi or xorgfonts75dpi from the official repositories) is installed on your system.
Sound
To confirm that MATLAB is able to use the default soundcard to present sounds run:
$ matlab nodesktop nosplash r "load handel; sound(y, Fs); pause(length(y)/Fs); exit" > /dev/null
This should play an except from Handel's "Hallelujah Chorus." If this fails make sure ALSA is properly configured. This can be done with the speakertest
program from the alsautils package from the official repositories:
$ speakertest
If you do not hear anything, then there is likely a problem with your system configuration.
GPU computing
MATLAB can take advantage of CUDA enabled GPUs to speed up applications. In order to take advantage of a supported GPU install the nvidia, nvidiautils, oclicd, openclnvidia, and cuda packages from the official repositories. To check if MATLAB is able to utilize the GPU run:
$ matlab nodesktop nosplash r "x=rand(10, 'single'); g=gpuArray(x); Success=isequal(gather(g), x), exit"  sed ne '/Success =/,$p'
Install supported compilers
In order to access the full functionality of MATLAB (e.g., to use Simulink, Builder JA, and MEXfile compilation), supported versions of the gcc
, g++
, gfortran
, and jdk
compilers must be installed. Details about the supported compilers for the current release and previous releases are available online. Many of the supported gcc
, g++
, jdk
compiler versions for past MATLAB releases are available from the AUR (e.g., gcc43^{AUR}, gcc44^{AUR}, gcc47^{AUR}, gcc49^{AUR}and jdk6^{AUR}), while past versions of the gfortran
compilers are not packaged.
To use previous versions of the the gcc
, g++
, and gfortran
compilers with MEX files, edit ${MATLAB}/bin/mexopts.sh
and replace all occurrences of CC='gcc'
with CC='gcc4.X'
, CXX='g++'
with CXX='g++4.X'
, and FC='gfortran'
with FC='gfortran4.X'
, where X
is the compiler version appropriate for the particular MATLAB release.
Help browser
The help browser uses valuable slots in the dynamic thread vector and causes competition with core functionality provided by libraries like the BLAS that also depend on the dynamic thread vector. The help browser can be configured to use fewer slots in the dynamic thread vector with
>> webutils.htmlrenderer('basic');
This is a persistent change and to reverse it use
>> webutils.htmlrenderer('default');
Garbled Interface
export J2D_D3D=false export MATLAB_JAVA=/usr/lib/jvm/java7openjdk/jre
Troubleshooting
Static TLS errors
MATLAB has a number of libraries that have been compiled with static thread local storage (TLS) including the help broswer doc
and the BLAS libraries. For example,
>> doc('help'); >> ones(10)*randn(10); Error using * BLAS loading error: dlopen: cannot load any more object with static TLS
is related to the bugs:
A more general solution of recompiling glibc
has also been suggested. [2]
MATLAB crashes when displaying graphics
To identify this error, start MATLAB with
LIBGL_DEBUG=verbose matlab
from the terminal and try to collect OpenGL information with opengl info
from the MATLAB command prompt. If it crashes again and there is an output line like
libGL error: dlopen /usr/lib/xorg/modules/dri/swrast_dri.so failed (/usr/local/MATLAB/R2011b/bin/glnxa64/../../sys/os/glnxa64/libstdc++.so.6: version `GLIBCXX_3.4.15' not found (required by /usr/lib/xorg/modules/dri/swrast_dri.so))
then the problem is that MATLAB uses its own GNU C++ library, which is an older version than the uptodate version on your Archlinux system. Make MATLAB use the current C++ library for your system by
cd /usr/local/MATLAB/R(your release)/sys/os/glnxa64 sudo unlink libstdc++.so.6 sudo ln s /usr/lib/libstdc++.so.6
If MATLAB still crashes or corrupts graphics (during startup or when plotting), make sure Java's 2D OpenGL rendering is disabled.
The environment variable _JAVA_OPTIONS
should not contain Dsun.java2d.opengl=true
.
Blank/grey UI when using DWM/Awesome
wmname is a utility to set the window manager name of the root window.
wmname LG3D
Then start Matlab.
Garbled or invisible text
Set the environment variable J2D_D3D
to false
[3].
In newer versions of MATLAB (R2015b) [4] this also requires setting MATLAB_JAVA
to something openjdk based. Example:
export J2D_D3D=false ./bin/glnxa64/install_unix javadir /usr/lib/jvm/java7openjdk/jre
If you notice that the menus or the input fields are corrupted or not appearing correctly then you can try to activate the "Use antialiasing to smooth desktop fonts" option in Matlab preferences, it seems to solve the problem. Go to Preferences > Matlab > Fonts and activate it. You will need to restart Matlab in order to take affect.
Installation
As one installs Matlab, it might complain that it cannot find a package, for the most part just look at the package name and then install it with Pacman, or in the case of x86_64 there are some libraries only in AUR.
Installtime library errors
 Make sure that the symlink
bin/glnx64/libstdc++.so.6
is pointing to the correct version oflibstdc++.so.xx
(which is also in the same directory and has numbers where 'xx' is). By default, it may be pointing to an older (and nonexistent) version (different value for 'xx').
 Make sure the device you're installing from is not mounted as
noexec
 If you downloaded the files from Mathworks' website, make sure they are not on an NTFS or FAT partition, because that can mess up the symlinks. Ext4 or Ext3 should work.
Resolving start warnings/errors
 Even if all needed libraries are installed, Matlab when starting can still report some missing libraries. This is resolved by symbolic linking of needed libraries to directories that Matlab checks at startup. For example, if Matlab triggers error/warning about missing
/lib64/libc.so.6
library, this can be resolved by:
# ln s /lib/libc.so.6 /lib64
 Matlab R2011b with an uptodate Arch Linux (as of March 12, 2012) fails on startup with the familiar "Failure loading desktop class." A solution is to point Matlab to the system JVM (confirmed to work with the jdk7openjdk package):
export MATLAB_JAVA=/usr/lib/jvm/java7openjdk/jre
Segmentation fault on startup
If Matlab stops working after upgrading ncurses to v6.x, install the ncurses5compatlibs^{AUR} package. See BBS#202575.
Hangs on rendering or exiting with Intel graphics
Some users have reported issues with DRI3 enabled on Intel Graphics chips. A possible workaround is to disable DRI3 and run MATLAB with hardware rendering on DRI2; to do so, launch MATLAB with the environment variable LIBGL_DRI3_DISABLE set to 1:
LIBGL_DRI3_DISABLE=1 /{MATLAB}/bin/matlab
If the previous workaround does not work, the issue can be circumvented by selecting software rendering with the MATLAB command (beware, performance may be very poor when doing e.g. big or complex 3D plots):
opengl('save','software')
Addon manager not working
Addon manager requires the libselinux^{AUR} package to work. (in Matlab 2016b)
Since upgrade from pango1.40.5 to pango1.40.6, the MATLABWindow application (responsible for AddOn Manager, Simulation Data Inspector and perhaps something else) cannot be started. [7]
A workaround is to point MATLAB shipping glib libraries to those glib libraries from your system. There are 5 of those libraries in matlabroot/R2017a/cefclient/sys/os/glnxa64
, namely, as of R2017a:
libgio2.0.so libglib2.0.so libgmodule2.0.so libgobject2.0.so libgthread2.0.so
Make it so that these symlinks are pointing to your system glib libraries instead of versions located in matlabroot/R2017a/cefclient/sys/os/glnxa64
.
Using webcam/video device
Make sure the correct support package addons are installed (webcam or OS Generic Video Interface for example). If running matlab as a user, make sure your user has write permissions to wherever the support packages are being downloaded and installed.
At least Matlab 2016b doesn't recognize webcams or imaq adapters correctly without gstreamer0.10. The gstreamer0.10 can be found in the aur and installed as a work around.
Since MATLAB R2017a, Image Acqusition Toolbox is using GStreamer library version 1.0. It previously used version 0.10.
MATLAB hangs for several minutes when closing Help Browser
Since upgrade of glibc from 2.24 to 2.25, MATLAB (at least R2017a) hangs when closing Help Browser. The issue is related to the particular version of jxbrowserchromium shipped with MATLAB.
To fix this issue, download the latest jxbrowser and replace the following jars from MATLAB:
matlabroot/java/jarext/jxbrowserchromium/jxbrowserchromium.jar matlabroot/java/jarext/jxbrowserchromium/jxbrowserlinux64.jar
MATLAB should automatically unpack those jars into matlabroot/sys/jxbrowserchromium/glnxa64/chromium
when first opening Help Browser.
Remove matlabroot/sys/jxbrowserchromium/glnxa64/chromium
directory to make sure MATLAB uses the latest jxbrowser.
In some interfaces  such as Simulation Data Inspector or Simulink Test Manager  nothing happens when choosing an item in dropdown menu (for example, when trying to change a number of subplots in Simulation Data Inspector). To work around this issue, hold down the Shift key while clicking the item in dropdown menu.