How can I bind .m files to MATLAB on Linux in MATLAB 7.9 (R2009b)?

1 回表示 (過去 30 日間)
Prabhakar
Prabhakar 2011 年 1 月 18 日
編集済み: Nathan Han 2020 年 10 月 20 日
I have .m files on Linux and want to double click on any of those to get the MATLAB Editor started and open the .m file I have just selected. It seems Linux does not recognize the .m file extension.

回答 (1 件)

Michael
Michael 2011 年 1 月 18 日
Here is one way to do it: http://www.walkingrandomly.com/?p=300
Here is an excerpt from the above link in case it is broken:
**** The following tip works on Ubuntu 8.10 running GNOME 2.24.1 but I imagine that a similar procedure would work for some other setups as well.
1. Right click on any .m file you like and, in the menu, click on:
Open With->Open With Other Application
2. Click on the arrow to the left of Use a custom command
3. In the resulting dialogue box type:
matlab -desktop -r "edit %f"
4. Click on Open. MATLAB will start up and then the editor will open your file. In future you will not need to type the above command because GNOME will have added an extra item to the Open With menu – namely Open with “matlab” ****
  2 件のコメント
Hank
Hank 2020 年 7 月 16 日
編集済み: Hank 2020 年 7 月 16 日
Hello Michael in 2011,
I manually created my matlab.desktop file to access ml from the launcher but MATLAB still won't appear in the "open with other application window". The "Use a custom command" option doesn't exist any longer in Ubuntu 20, MATLAB R2020a.
I've tried add the following line to my default.list file, no luck.
text/m=matlab.desktop
Any ideas?
Nathan Han
Nathan Han 2020 年 10 月 20 日
編集済み: Nathan Han 2020 年 10 月 20 日
Hi Hank,
Speaking of editing default.list, try:
text/x-matlab=matlab.desktop
or
text/x-objcsrc=matlab.desktop
depending on what the .m file shows in its properties.
e.g.

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

カテゴリ

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

タグ

製品

Community Treasure Hunt

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

Start Hunting!

Translated by