How to open multiple matlab files in one instance of the matlab by double clicking in Ubuntu

6 ビュー (過去 30 日間)
I want to be able to open matlab files in Ubuntu simply by doubly clicking on them (same like it is working on MacOs or Windows).
To do that I've added matlab to the list of applications and associated it to the *.m and *.fig files in my file manager. So now I can open *.fig and *.m files by double-clicking on them. The problem is that every new file is starting new instance of matlab instead of opening it in the already launched one.
Is it possible to fix it?
the matlab.desktop file that I'm using is:
[Desktop Entry]
Version=1.0
Type=Application
Terminal=false
Exec=matlab -desktop -r "open %f"
Name=MATLAB
Icon=/usr/share/icons/hicolor/48x48/apps/matlab.png
Categories=Development;Math;Science
Comment=Scientific computing environment
StartupNotify=true
StartupWMClass=com-mathworks-util-PostVMInit
matlab version is R2019a
Ubuntu version is 18.04.3
  1 件のコメント
Moritz Feuerle
Moritz Feuerle 2020 年 2 月 29 日
I have the same problem. It is realy annoying, would be great if there is a solution for that

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

回答 (2 件)

Sai Sri Pathuri
Sai Sri Pathuri 2020 年 3 月 3 日
Unfortunately, this is expected behavior on Linux. Only Windows and Mac have special implementations of double-click behavior. The desired double-click behavior is unavailable on Linux.
These are some alternatives you can try instead:
1. Dragging the .m file onto the MATLAB Command Window which caused MATLAB to run the file
2. By dragging it on top of the Editor window (if it was already visible) which caused MATLAB to edit the .m file
  1 件のコメント
Ali Aghaeifar
Ali Aghaeifar 2022 年 11 月 3 日
But in other applications, e.g., gedit, double-click behavior is as expected, i.e., all files open in one instance of gedit.

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


David Capan
David Capan 2022 年 9 月 10 日
Exec=matlab -desktop -r "open %F"
This should work.
%f for one file, %F for multiple files.

カテゴリ

Help Center および File ExchangeStartup and Shutdown についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by