How to run one instance of matlab in linux when opening a .m file
6 次查看(过去 30 天)
显示 更早的评论
I am running matlab from linux POP OS. I have managed to write a .desktop file in my user applications folder to open MATLAB when I double click on a *.m file ; however, my new problem is that every matlab file i click on creates yet a new instance of MATLAB. I want MATLAB to beahve like in the windows environment where I can double click and open a few file in the same instance of matlab as a new page in the editor.
[Desktop Entry]
Type=Application
Name=MATLAB 2024a
Icon=/usr/share/icons/matlab_icon.png
Exec=/usr/local/MATLAB/R2024a/bin/matlab "open %f"
Categories=Development
Terminal=false
~
Thanks for any help.
0 个评论
回答(1 个)
Malay Agarwal
2024-3-26
Hi Cyrus,
I understand that you want to associate MATLAB files in Linux so that they launch in the same MATLAB instance when double-clicked.
I tried the MATLAB CLI on different platforms (Windows, Linux and Mac) and in all cases, it launches a new instance of MATLAB. This suggests that a “.desktop” file where the “Exec” directive is a call to the MATLAB CLI cannot be used to get the desired behaviour since it will always launch a new MATLAB instance.
This also suggests that the behaviour as observed in Windows and Mac is part of MATLAB’s source code and the functionality has not been implemented for Linux. This is also confirmed by the following answer by MathWorks staff: https://www.mathworks.com/matlabcentral/answers/502862-how-to-open-multiple-matlab-files-in-one-instance-of-the-matlab-by-double-clicking-in-ubuntu.
Hope this helps!
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Startup and Shutdown 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!