在 Linux 上装过 Matlab 的同学都可能遇到过这样的情况: 无论将桌面电脑字体调多大, Matlab 的字体总是那么小, 一通 Google 后, 找到如下解答:
MATLAB supports High DPI screens on Linux starting from R2017b. Tuning a high-DPI Linux system requires two steps:
- Setting the MATLAB scale factor
- Calibrating the system's DPI The MATLAB scale factor affects MATLAB desktop and the size/position of windows. The system DPI determines the scale and font size of axes and labels.
The two tuning steps are described below:
- To set the MATLAB scale factor, please execute the following commands in the MATLAB Command Window: (Here the scale factor has been set to 1.5.)
>> s = settings;s.matlab.desktop.DisplayScaleFactor >> s.matlab.desktop.DisplayScaleFactor.PersonalValue = 1.5
- To calibrate the system's DPI to match the scale factor, please use the following terminal commands:
1 2 3
$ xdpyinfo | grep resolution resolution: 96x96 dots per inch $ xrandr --dpi 182.4
The DPI value chosen should be the resolution found with "xdpyinfo" multiplied by the MATLAB scale factor that was set. In the example, 96 × 1.5 = 144. MATLAB must be restarted after Step 2.
In earlier releases than R2017b, high DPI screens on Linux is not supported. The possible workarounds mentioned below may help improve the visual appearance:
- You can increase font sizes of text in the different windows. However, the icon or font size of the toolbar cannot be changed.
- You can switch the high DPI monitor to a lower screen resolution, for example 1920x1080 or as preferred.
- You can connect a lower resolution monitor and use MATLAB on that monitor.
将第一个代码块的内容输入到 Matlab, 随后, 将第二个代码块的内容输入到 Terminal 中即可. 亲测 R2018a 可用.
请根据自己设备的分辨率，自行改变上述数值，我的 2.5k 屏配置如下
- Ubuntu 20.04 LTS
- Intel® Core™ i5-10210U CPU @ 1.60GHz × 8
- 分辨率 2560 × 1600(16:10)
- GNOME 3.36.0
- 64 位