Why aren't my MATLAB preferences saved on Linux?

18 ビュー (過去 30 日間)
Shervin Sahba
Shervin Sahba 2022 年 9 月 15 日
編集済み: Xiaowei Lin 2023 年 4 月 3 日
I'm using R2022b on Linux. On first boot, I switched my keyboard shortcuts to Windows style and turned on font anti-aliasing. These affects persist between sessions.
Now, however, whatever changes I make to the preferences do not persist. e.g. If I switch the font size to 12, it reverts to 10. If I change the theming, it reverts.
Running `prefsdir` in MATLAB always shows the same directory, `~/.matlab/R2022b`, so I don't think it has trouble finding the directory. The only error that pops up when I launch `matlab` from terminal is related to libcanberra, but that's a sound library.
Any ideas? Am I missing something obvious? I'd really like to have persistant preferences. Thanks.
  3 件のコメント
Shervin Sahba
Shervin Sahba 2022 年 9 月 21 日
@Chris got a hack working and put info in the answer section. I'm on an Arch system as well, so hopefully this bug gets resolved.
Chris
Chris 2022 年 9 月 21 日
Nice. Seems like it may get some attention as a bug too, looking at the other post.

サインインしてコメントする。

採用された回答

Shervin Sahba
Shervin Sahba 2022 年 9 月 21 日
編集済み: Shervin Sahba 2023 年 2 月 27 日
Found a fix. It looks like some sort of issue with how matlab is utilizing the /tmp directory. I don't fully understand what's happening, but as a hack, you can create an auxiliiary temp directory for MATLAB to use inside your home directory. I put it under the cache directory, like so:
mkdir ~/.cache/matlab-tmp
Then matlab can be launched from command line with the environment variable for the TMPDIR exported as
TMPDIR=~/.cache/matlab-tmp matlab -desktop
Any changes to preferences made while using this surrogate temp directory should actually save and persist on your next session.
I'll probably rely on this temp directory from here on out, as I don't see an issue with using it. To launch matlab with this environment variable more easily, you can write up a shell script or add a desktop file like the following. Here's my ~/.local/share/applications/matlab.desktop, which tells Matlab to rely on the new tmp and purges its contents after you're done.
NOTE: Change <username> below to your username! This is only a placeholder, and leaving it unchanged may damage your system!
[Desktop Entry]
Type=Application
Version=R2022b
Name=MATLAB
Comment=Scientific computing software
Icon=/home/<username>/.local/share/applications/matlab_logo.png
Exec=bash -c "export TMPDIR=/home/<username>/.cache/matlab-tmp; matlab -desktop; rm -r $TMPDIR"
Terminal=False
  10 件のコメント
Rudy Richardson
Rudy Richardson 2023 年 2 月 27 日
Thanks! This worked for me on Linux Mint 21.1 Xfce (based on Ubuntu 22.04 LTS) and Matlab R2202b.
Shervin Sahba
Shervin Sahba 2023 年 2 月 27 日
I made a slight edit to the script, changing rm -r $TMPDIR/* to rm -r $TMPDIR.
This should prevent any gross file deletions if there's a typo or something that causes TMPDIR to fail to declare.
You can also just leave the removal part out entirely unless you notice matlab storing large files.

サインインしてコメントする。

その他の回答 (2 件)

Batuhan Baserdem
Batuhan Baserdem 2022 年 12 月 30 日
This fix is not working for me; coupled with another bug that vcs integration causes matlab to crash; matlab is completely unusable for me; unless I act quick enough to open preferences and disable vcs integration on every launch. Really annoying.

Xiaowei Lin
Xiaowei Lin 2023 年 4 月 1 日
編集済み: Xiaowei Lin 2023 年 4 月 3 日
This fix works for me.
I combine this thread with the DPI thread: https://ch.mathworks.com/matlabcentral/answers/406956-does-matlab-support-high-dpi-screens-on-linux succesfully to get a scaled-up version of MATLAB in Ubuntu using a high resolution monitor.
However the checkboxes in the menus, the sliding bar, the opening photo of MATLAB, etc. are still small.

カテゴリ

Help Center および File ExchangeEnvironment and Settings についてさらに検索

製品


リリース

R2022b

Community Treasure Hunt

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

Start Hunting!

Translated by