Score:1

Matlab: incomplete scaling / ignoring system scaling

al flag

Personal context: I am relatively new to Linux and not aware of some things that may appear basic to more experienced users.

I have a 3840 x 2400 (16:10) display that is scaled to 200% in settings and this puts almost all applications at a good size for me.

Problem context: I installed matlab onto my laptop running Ubuntu 22.04.1 and the app runs with no issues. My only problem with it is that everything is displayed very small within the app.

My research: A solution I have come across is to use the following command in matlab: s = settings;s.matlab.desktop.DisplayScaleFactor.PersonalValue = 2.5. This scales most things to a good size for me however, there are some things left unchanged by the command. Some of the things left unscaled are the text displayed when hovering over menu icons, the initial startup info screen, and some pop-up windows that are produced from the main window.

Another solution I have tried is to use the command run_scaled to individually scale the application. This appears to work initially but renders the application unusable in other ways and just overall doesn't seem to be built as a long term solution for a daily use application. I can go into more detail on this if it seems like the correct approach.

Request: I would greatly appreciate it if anyone would share ideas on how to increase the size of all parts of the application as opposed to just a few as I am in a situation where I need to use some of the unscaled features.

Thoughts: It seems odd to me that matlab seems to simply ignore the scaling for the rest of the system.

Rational: I am asking this question here as opposed to on a matlab forum because I have experienced similar scaling issues with a few other applications.

mchid avatar
bo flag
Did you calibrate the system's dpi by running `xdpyinfo | grep resolution` to get the current dpi and then multiplying that by the personal value (2.5) to set `xrandr --dpi `? For example, if `xdpyinfo` returns 96x96, then you would multiply 96 by 2.5 and then set `xrandr --dpi 240` Of course, I believe you'll need to be logged in using X11 instead of Wayland so you can use `xrandr`
bill avatar
al flag
This fixes the most of the issues within matlab during the X11 session where I run ```xrandr --dpi 240```, but as soon as I log out and back in again, the dpi changes back to the default 96x96. Is there any way to save these changes so that they persist to the next session?
mchid avatar
bo flag
Yes. I included this at the end of the answer below. If that doesn't work, just let me know and you can simply add the command to your startup applications instead.
Score:0
bo flag

So you have the personal value set as described in your question:

s = settings;s.matlab.desktop.DisplayScaleFactor.PersonalValue = 2.5

First, run:

xdpyinfo | grep resolution

to get the current dpi.

Next, multiply the current dpi by your personal value (2.5).

Finally, use this new number to set your dpi:

xrandr --dpi <the value of your current dpi multiplied by personal value>

For example, if your current dpi is resolution: 96x96 dots per inch you would multiply 96 by 2.5 to get 240:

xrandr --dpi 240

To make this change persistent, you can add the xrandr --dpi 240 command to your ~/.xprofile file (create this file if it does not exist).

And then edit your /etc/X11/xinit/xinitrc file and add the following lines if they do not already exist:

# Make sure this is before the 'exec' command or it won't be sourced.
[ -f /etc/xprofile ] && . /etc/xprofile
[ -f ~/.xprofile ] && . ~/.xprofile

Of course, you can use:

sudo nano /etc/X11/xinit/xinitrc

to edit this file. Copy and paste the lines above into the file, and when you are done editing, press CTRL+o to save the changes and then press CTRL+x to exit nano.

bill avatar
al flag
Thank you very much for the response, this solution is very helpful. The changes to those files made the dpi of 240 persist through different X11 sessions. The dpi of 240 does not persist however when changing to a wayland session. Do you know how I could achieve this same effect when on a wayland session?
I sit in a Tesla and translated this thread with Ai:

mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.