I open MATLAB:

$ matlab &
[1] 3099

I right-click its new icon on the dock and click 'Lock to Launcher'.

The next time I try to use MATLAB, I click the new dock icon. MATLAB acts like it's succesfully opening (shows the startup graphic briefly, taskbar icon flashes like it's in-progress), but then it stops, apparently automatically terminating.

What's wrong? How do I add MATLAB to dock (so I can merely click an icon instead of opening it from Terminal)?

I suspect what's wrong is that unlike other software with a 'permanent' something (process ID?), MATLAB's something changes each time, and so 'Lock to Launcher' doesn't work to open it each time ...

  • Have you tried creating a .desktop for MATLAB? – M. Becerra Jan 23 '18 at 8:27
  • No. I don't know what a .desktop is nor how to create one, and I suspect the 'matlab' command is a symbolic link (whatever that is) rather than an executable. (How did you format that text, by the way?) – DBinJP Jan 23 '18 at 10:33
  • You can figure that out with type -a matlab – M. Becerra Jan 23 '18 at 10:35
  • 1
    Btw, to format code or similar, surround it with ` – M. Becerra Jan 23 '18 at 10:42
  • 1
    No, you should type type -a matlab. The command is called "type" – gustavwiz Jan 24 '18 at 9:01

Create a matlab.desktop file in ~/.local/share/applications

[Desktop Entry]
Exec=*location to matlab*
Icon=*location to icon (optional)*

You can use whereis matlab to find the location to matlab.

The last line is optional, either you have to find a suitable icon for matlab on your computer, or download one and store it where appropriate.

Finally, make it executable with sudo chmod +x matlab.desktop, or by right clicking on the file in the file manager, and make it executable under permissions.

  • In that folder there already is a file matlab_r2017b_-_student_use.desktop, however Right-Click -> Open returns the error message that it's untrusted due to installation from an unknown source. (Apparently doing something with it can execute the command /usr/local/MATLAB/R2017b/bin/glnxa64/MATLAB...) I see the Execute checkbox to mark in Properties > Permissions, and that turned the default Aa icon into the MATLAB logo icon! Then I was able to drag and drop it onto the dock! ... However, the behavior is the same as the OP: It appears to self-terminate. What should I do with this .desktop? – DBinJP Jan 24 '18 at 8:01
  • It turns out you have to add Terminal=true to the desktop file to make sure it doesn't self terminate. – gustavwiz Apr 13 at 15:00

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.