Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

I was trying to add the installed matlab to the menu of Applications under Ubuntu 10.10.

I clicked Gnome-Menu -> Preference -> Main Menu -> Programming -> New Item, where I input the Matlab file .../MatlabR2010b/bin/matlab as the command, and selected the type to be "Application". Then I finished.

But when I click the item in the menu of Applications, the Matlab icon shows up for a few seconds and then nothing else happens.

If I select the type to be "Application in Terminal", then in the last step of adding Matlab to the Applications Menu, after I click the item in the menu of Applications, there will be firstly a terminal window and then the Matlab command window.

So I was wondering how to solve the problem of Matlab not starting when the type has been selected to be "Application"? Also is there a way to eliminate the terminal appearing when the type has been selected to be "Application in Terminal"?

share|improve this question
    
The terminal will be visible, since it has launched as an application from terminal. If there is no terminal, its as good as launching as an application. What is the output of ls -l ../MatlabR2010b/bin/ I am guessing the matlab command is actually a script and not an executable. –  theTuxRacer Feb 17 '11 at 6:02
    
@Kautubh: Thanks! The first line is #!/bin/sh. –  Tim Feb 17 '11 at 14:40
add comment

7 Answers

up vote 11 down vote accepted

I found some useful instructions which work for me (Ubuntu 10.04).

Screeshot of the Launcher Properties The command to copy-paste after having checked your version: /usr/local/MATLAB/R2012b/bin/matlab -desktop

share|improve this answer
1  
This is indeed very useful. To perform this in any version of Ubuntu, you will need the app called 'Alacarte'. Follow this link to install: apt.ubuntu.com/p/alacarte . –  Agmenor Feb 22 '12 at 20:15
add comment

Although I'm using a more recent version of Ubuntu (and Matlab), this worked great for me: I just installed Matlab 2012b on Ubuntu 12.10 and followed up by installing the matlab-support package in the Ubuntu Software Centre:

sudo apt-get install matlab-support

(As per this answer in a related question: http://askubuntu.com/a/140078/16835)

This will add a desktop icon/launcher, as well as allow you to fix the compiler linking problem.

share|improve this answer
add comment

Its also nice to not have two icons in the launcher while MATLAB is running. To accomplish this, edit the *.desktop file containing the launcher for MATLAB (grep for matlab in ~/.local/share/applications) add add the following line to the bottom

StartupWMClass=com-mathworks-util-PostVMInit
share|improve this answer
1  
Thanks! What do you mean by "have two icons in the launcher while MATLAB is running"? Can you post a snapshot? –  Tim Dec 12 '11 at 19:43
add comment

As Kaustubh P said, it could well be a script. The best way to tell is to try head -1 .../MatlabR2010b/bin/matlab and see if it starts with #!/bin/sh or similar.

If it is a script you may wish to set your gnome menu entry to "Application" and setting the command to

/bin/sh -c .../MatlabR2010b/bin/matlab
share|improve this answer
    
Thanks! What does -c in /bin/sh -c mean? is /bin/sh same as bash? –  Tim Feb 17 '11 at 14:36
    
The first line of the file is #!/bin/sh. I tried "Application" with command "/bin/sh -c .../MatlabR2010b/bin/matlab ", but the problem remains i.e. just the Matlab icon flashes without actually Matlab starting. –  Tim Feb 17 '11 at 14:41
    
@Tim The -c tells the shell to perform the commands in the following command string. On Ubuntu /bin/sh launches the dash shell, which is a POSIX-compliant shell, but has a more minimal feature set than bash. However, I am not sure why this still isn't working for you. –  Jon Brett Feb 18 '11 at 8:20
add comment

Ok, try this:

Right click on an empty part on your Gnome Panel, click Custom Application Launcher

Make sure the entries are similar to the ones in the image.

Launcher

Let us know i it worked!

share|improve this answer
1  
Thanks but it still doesn't. –  Tim Feb 18 '11 at 15:04
add comment

you need use -desktop parameter after the command which means you should write in command like bin/matlab -desktop.

share|improve this answer
add comment

There is a very informative page on the ubuntu wiki:

https://help.ubuntu.com/community/MATLAB

It is not yet updated for the 2012 version but I can confirm the instructions are still working.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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