相关推荐recommended
ubuntu20.04 安装 matlab R2023b
作者:mmseoamin日期:2024-02-24

ubuntu20.04 使用matlab R2023b

  • 起因
  • 步骤
  • 问题
    • 问题1
    • 问题2
    • 问题3

      起因

      闲着没事,想在ubuntu上安装matlab。

      步骤

      这个博客写得很好,我就不赘述了:参考博客 。但有点不一样:我现在matlab官网上下载的linux版本不是iso镜像文件,直接是一个zip压缩文件,不用什么挂载了。直接解压缩,然后再运行install文件。后面可以直接点击图标运行matlab。

      问题

      问题1

      运行matlab会报错:

      Gtk-Message: 15:46:15.337: Failed to load module "canberra-gtk-module"
      

      这篇博客分析的很清楚:参考博客

      执行这两步就行了:

      sudo apt-get install libcanberra-gtk-module -y
      
      sudo ln -s /usr/lib/x86_64-linux-gnu/gtk-2.0/modules/libcanberra-gtk-module.so /usr/lib/libcanberra-gtk-module.so
      

      问题2

      在matlab窗口中可以看到这样的提示:

      com.jogamp.opengl.GLException: X11GLXDrawableFactory - Could not initialize shared resources for X11GraphicsDevice[type .x11, connection :0, unitID 0, handle 0x0, owner false, ResourceToolkitLock[obj 0x535b6672, isOwner false, <15a2f11f, 7c843551>[count 0, qsz 0, owner ]]]
      at jogamp.opengl.x11.glx.X11GLXDrawableFactory$SharedResourceImplementation.createSharedResource(X11GLXDrawableFactory.java:326)
      at jogamp.opengl.SharedResourceRunner.run(SharedResourceRunner.java:297)
      at java.lang.Thread.run(Unknown Source)
      Caused by: com.jogamp.opengl.GLException: glXGetConfig(0x1) failed: error code Unknown error code 6
      at jogamp.opengl.x11.glx.X11GLXGraphicsConfiguration.glXGetConfig(X11GLXGraphicsConfiguration.java:570)
      at jogamp.opengl.x11.glx.X11GLXGraphicsConfiguration.XVisualInfo2GLCapabilities(X11GLXGraphicsConfiguration.java:500)
      at jogamp.opengl.x11.glx.X11GLXGraphicsConfigurationFactory.chooseGraphicsConfigurationXVisual(X11GLXGraphicsConfigurationFactory.java:434)
      at jogamp.opengl.x11.glx.X11GLXGraphicsConfigurationFactory.chooseGraphicsConfigurationStatic(X11GLXGraphicsConfigurationFactory.java:240)
      at jogamp.opengl.x11.glx.X11GLXDrawableFactory.createMutableSurfaceImpl(X11GLXDrawableFactory.java:524)
      at jogamp.opengl.x11.glx.X11GLXDrawableFactory.createDummySurfaceImpl(X11GLXDrawableFactory.java:535)
      at jogamp.opengl.x11.glx.X11GLXDrawableFactory$SharedResourceImplementation.createSharedResource(X11GLXDrawableFactory.java:283)
      ... 2 more
      

      这篇博客给出了解决办法参考博客 。

      也就是先这样启动matlab:

      ./matlab -softwareopengl
      

      再在matlab命令行中执行:

      opengl('save','software')
      

      然后退出。以后直接运行./matlab也不会出现上述报错了。

      问题3

      记录一下:

      ubuntu20.04 安装 matlab R2023b,在这里插入图片描述,第1张

      我选了否,如果以后出问题,来这里排查。

      目前没碰到问题,在软件中找到matlab图标,点击就能运行,很方便。以后遇到matlab,不用再回到windows了~

      ubuntu20.04 安装 matlab R2023b,在这里插入图片描述,第2张