0

I had installed MATLAB 2017b in my Ubuntu 18.04 PC and am able to execute it as :

sudo /usr/local/MATLAB/R2017b/bin/matlab -desktop

I intend to install another version sometime in the future as well.

I'm trying to create a command style terminal launcher matlab2017b (like how other applications like gedit, for example, can be executed) as:

sudo cp /usr/local/MATLAB/R2017b/bin/matlab /usr/local/sbin/matlab2017b

which gives the error:

/usr/local/sbin/matlab2017b: 454: .: Can't open /usr/local/bin/util/arch.sh

Tried creating a bash alias too in ~/.bashrc as:

alias matlab2017b='/usr/local/MATLAB/R2017b/bin/matlab'

It gives the same error as above too.

What is going wrong here? Shouldn't placing the executable in any of the paths inside $PATH be enough? And how to execute it in terminal by running just matlab2017b?

2
  • The script probably uses its location as a reference for where the MATLAB files are located. Have you tried a symlink? sudo ln -sf /usr/local/MATLAB/R2017b/bin/matlab /usr/local/sbin/matlab2017b?
    – muru
    Commented Sep 19, 2018 at 8:41
  • @muru That did it! Could you explain in a post below as an answer? Commented Sep 19, 2018 at 8:47

1 Answer 1

2

The matlab script likely tries to find the Matlab directory by looking up the location of the script (see, for example, Get path of current script when executed through a symlink). This will fail if you copy the script to another location, but the popular solutions support symlinks, so you can try with a symlink instead:

sudo ln -sf /usr/local/MATLAB/R2017b/bin/matlab /usr/local/sbin/matlab2017b
2
  • I am unable to use matlab2017b in launcher .desktop file to execute from gnome. Why can't I do that? Can you help me with that? Commented Sep 20, 2018 at 4:26
  • @skrowten_hermit please post a new question about that. Also include the contents of the .desktop file you created.
    – muru
    Commented Sep 20, 2018 at 4:44

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .