Defautl to open *.m files in MATLAB, linux

조회 수: 10 (최근 30일)
Hank
Hank 2020년 7월 16일
댓글: Paul Wright 2021년 4월 6일
MATLAB R2020a, Ubuntu 20.04
I am trying to set MATLAB to open m files by default. MATLAB doesn't appear in the "Open with other Application" dialog.
This has been a problem in the past, but the solution doesn't work on modern Ubuntu.
I tried editing my defaults.list file by adding the line "text/m=matlab.desktop". This did not help.
Thanks for your answer.

채택된 답변

Lukas Pospichal
Lukas Pospichal 2020년 7월 16일
편집: Lukas Pospichal 2020년 7월 16일
I had the same issue. I just now fixed it. In ubuntu 18.04. which I had previously I just installed the matlab application from the Ubuntu Software app. But in ubuntu 20.04 you need to use the Software app
And there install the package:
This will create the matlab.desktop file and from there you can just follow the instructions you linked (adding -r "edit %f" after the launch command). Hope this helps.
  댓글 수: 6
Paul Wright
Paul Wright 2021년 4월 6일
Two notes:
  1. The quotes are really important. Without them, MATLAB just opens an empty editor because the filename is parsed as a separate argument to MATLAB, rather than part of the command for MATLAB to run.
  2. Changing the .desktop file in this way makes MATLAB open with an empty editor window if you're just launching MATLAB directly from its icon. There must be a way to make the -r "edit %f" part conditional. I'm creating a separate question about that.
Paul Wright
Paul Wright 2021년 4월 6일
Uh-oh:
"Field codes must not be used inside a quoted argument, the result of field code expansion inside a quoted argument is undefined."
https://specifications.freedesktop.org/desktop-entry-spec/desktop-entry-spec-latest.html#exec-variables

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Introduction to Installation and Licensing에 대해 자세히 알아보기

제품


릴리스

R2020a

Community Treasure Hunt

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

Start Hunting!

Translated by