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

7 visualizzazioni (ultimi 30 giorni)
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

Risposte (2)

Sai Sri Pathuri
Sai Sri Pathuri il 3 Mar 2020
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

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

Categorie

Scopri di più su Startup and Shutdown in Help Center e File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by