MATLAB HiDPI setting ignored on Linux (Ubuntu)

13 visualizaciones (últimos 30 días)
Dimitris Kosmas
Dimitris Kosmas el 13 de Oct. de 2022
Respondida: Luke Howard el 5 de Jul. de 2024
Hi,
I am running a fresh install of MATLAB R2022b on Ubuntu 22.04.
  • Laptop: HP Zbook Fury G7 (screen resolution 3840x2160)
  • GPU1: Intel Cometlake-H GT2
  • GPU2: NVidia Quadro T1000.
MATLAB install script was executed as sudo, as described here (link [MATLAB]). There have been several related questions in MATLAB Answers (link1, link2, and many more related to Windows) but none seem to work for this case.
Few observations:
  • If xrandr is not used, the scaling setting is completely ignored.
  • Executing the xrandr with the calculated DPI, seems to affect only the splash screen, but not the MATLAB interface.
  • After xrandr, changing the scaling setting in MATLAB affects the editor only (without restart). This is behavior is again lost after restart.
  • Changing permission (as suggested by one comment) in the ~/.matlab file, did not work.
  • Installing MATLAB as non-sudo yields the same results.
Anyone knows if there is anything else I could try? Besides lowering the screen resolution, since that results in blurriness.
Thanks!
Edit 1: Typo
Edit 2: Looking around it seems to be a permission issue. For testing purposes only, I added 'root' user to the license and when changing the scaling setting it is honored as expected. In the ~/.matlab folder for the root user, the main differences is the presense of *.mlsettings binary files. Although, giving full persmissions to the $USER for both ~/.matlab as well as /usr/local/MATLAB folder does not seem to affect the process in any way.
Current workaround: copying matlab.mlsettings file from the root to the user's .matlab directory seems fix the issue. But this is far from a solution. Modyfing any setting of these settings/preferences require to first run matlab as root, make the modifitiations and then copy-paste the relevant *.mlsettings files. Will update when I have more.
Edit 3: A better workaround (no root needed): It seems that if a desktop launcher is used (matlab-support package), bash is not run in advance and MATLAB does not access the system enviroment variables, including the TMPDIR/TMP. Then (for some reason..) MATLAB can not access the /tmp/ folder and this is probably where things break. Two ways go around this are:
  1. Run matlab from terminal where bashrc is already sourced (including for example a TMP var to an accessible folder, e.g. ~/.tmp/).
  2. Or, change the default MATLAB tempdir. This is inspired from the workaround of 'Invalid cross-device link (18)' error I also exprerienced when trying to save a document (link3). Although, this setting is again lost after a restart, at least for me.

Respuestas (1)

Luke Howard
Luke Howard el 5 de Jul. de 2024
I have been sifting around for another solution which I found at the link below, all that is required is entering the following once matlab is started and then resetting for changes to take affect. Not nessecarily fixing the setting issue but will fix High DPI scaling.
>> s = settings;s.matlab.desktop.DisplayScaleFactor
>> s.matlab.desktop.DisplayScaleFactor.PersonalValue = 2
Worked for me, running Ubuntu 22.04, DellXPS15 9570

Categorías

Más información sobre Introduction to Installation and Licensing en Help Center y File Exchange.

Etiquetas

Productos


Versión

R2022b

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by