Linux安装MATLAB

Linux下的MATLAB在2013a及以后的版本中,就不再支持32位机了。所以32位Linux系统无法安装2013a及以后版本。[1]

Linux下安装MATLAB时,需要先配置好JRE,可以参考:Linux下Java环境配置。

安装过程如下:

  • 挂载iso镜像:
    sudo mount <matlab_iso> <mount_dir>
    sudo mount MATLAB2012b.iso /mnt/matlab/
  • 执行安装程序:
    sudo <mount_dir>/install

  若在安装过程中出现错误,或安装终止,很可能是因为无法正确找到JRE导致的(Linux下Matlab的图形界面是依赖jre的,如果jre配置出现问题,无法弹出执行安装的图形界面)。可以执行:

sudo <mount_dir>/install -help
Usage: install [-h|help]
                             [-javadir <directory>] | [-root <directory>] |
                             [-test] | [-v|-verbose]

    -h|-help        - Display arguments.
    -test           - Don't actually run the java command (only useful with -v).
    -v|-verbose     - Display settings.
    -javadir <directory>       - Override default java root directory.
    -root <directory>          - Override default DVD root directory.
    -tmpdir <directory>        - Override default directory for temporary files.

    The default settings when no override inputs are supplied are: 
    -root = <directory containing this script>
    -javadir = <root>/sys/java/jre/glnxa64/jre
    -tmpdir = /tmp

  根据上面帮助文件的提示,我们可以知道,在执行install时,需要指定合适的javadir,也就是安装的JRE的路径。如:

sudo <mount_dir>/install -javadir=<jre_dir>
  • 根据提示输入验证信息,安装MATLAB
  • 配置desktop文件:
    • 方法一:安装matlab-support,在Ubuntu下,输入:
      sudo apt-get install matlab-support
    • 方法二:自己配置Matlab.desktop文件。配置完成后需要将Matlab.desktop文件放到/usr/share/applications/或者 ~/.local/share/applications/目录下。desktop示例如下:
      [Desktop Entry]
      Version=1.0
      Type=Application
      Terminal=false
      Exec=matlab -desktop
      Name=MATLAB
      Icon=/usr/share/icons/hicolor/48x48/apps/matlab.png
      Categories=Development;Math;Science
      Comment=Scientific computing environment
      StartupNotify=true
      StartupWMClass=com-mathworks-util-PostVMInit

以上配置结束后,就可以正常使用MATLAB了。另外,Linux下的MATLAB还支持命令行中使用,即不显示MATLAb的图形界面,这样就可以很好的结合Shell了。具体可以参考:在命令行下运行MATLAB

参考:

[1] The Mathworks, Inc. MATLAB&Simulink Inatallation Guide R2013a [Z]. 2013

原文地址:https://www.cnblogs.com/beanocean/p/3520081.html