8

I use whereis matlab and find: /usr/local/bin/matlab , which is a very long bash file.

How can I find where matlab is installed, I mean, its installed folder.

EDIT:

I used the following method: open matlab and use edit svds.m to open the svds.m file and the editor shows the folder:)

1
  • 1
    What is your linux distribution? Is matlab installed as rpm package or from source/tarball? May 28, 2010 at 14:48

7 Answers 7

13

Try

locate MATLAB

The binary file is spelled with all-caps. In my system, the MATLAB executable is installed in /usr/local/matlab/r2009b/bin/glnxa64/MATLAB (which is a slightly weird place). The matlab root would then be /usr/local/matlab/r2009b

Of course, normally you do run matlab using the long shell script...

2
  • 1
    Note: you might need to run sudo updatedb once before running locate (it's possible it won't find nearly as much otherwise). May 28, 2010 at 14:55
  • I first needed to install ti: sudo apt install mlocate, than the locate MATLAB worked.
    – Danijel
    Dec 4, 2020 at 7:35
3

I did

cat `which matlab` | grep matlab

with output

exec /usr/local/bin/matlab64 -r maxNumCompThreads=4 $*
    echo "   qsub -I -V -l nodes=1,matlab=1"
            exec /usr/local/bin/matlab64 $*
            exec /usr/local/bin/matlab32 $*

Then

$ ls -ld /usr/local/bin/matlab64
lrwxrwxrwx 1 root root 30 May  4 12:08 /usr/local/bin/matlab64 -> /usr/local/matlab64/bin/matlab
$ ls -ld /usr/local/bin/matlab32
lrwxrwxrwx 1 root root 28 May  4 12:08 /usr/local/bin/matlab32 -> /usr/local/matlab/bin/matlab
$ ls -ld /usr/local/matlab64 
lrwxrwxrwx 1 root root 27 May  4 12:01 /usr/local/matlab64 -> /usr/local/matlab_2010a-64/
$ ls -ld /usr/local/matlab 
lrwxrwxrwx 1 root root 23 May  4 12:01 /usr/local/matlab -> /usr/local/matlab_2010a

EDIT: The better way is to do it from matlab command line with matlabroot.

>> matlabroot

ans =

/usr/local/matlab_2010a-64
1
  • 2
    Useless use of cat: grep matlab $(which matlab) May 28, 2010 at 16:33
1

On RPM based distributions you can use

rpm -ql <package_name>

It will show you all files from the package

# rpm -ql wget
/etc/wgetrc
/usr/bin/wget
/usr/share/doc/wget-1.10.2
/usr/share/doc/wget-1.10.2/AUTHORS
....

If you're not sure how the package is called, you may use something like rpm -qa | grep -i matlab to find its name

0

Tthe locations would depend (as Dmitry has suggested) on how you installed the packages. Usually, installation from source would dump the binaries and related files in /usr/local. For details on where standard distributions (like Debian and others put files), consult the Filesystem Hierarchy Standard.

0

Your package manager might tell you. YAST in opensuse has a files tab, which shows all the files and location they get installed to. I can't speak for other distros.

0

In Linux environment, you can run the following code to get MATLAB paths

matlab -e | sed -n 's/MATLAB=//p'

where matlab -e will output a lot of information to run MATLAB. So we need to pipe them to sed -n 's/MATLAB=//p' to only select the MATLAB root. I use this in my Makefile document to find the path to mex compiler without start MATLAB. It is very quick command. Here is what I used in my Makefile document just for convenience:

MATLAB = $(shell matlab -e | sed -n 's/MATLAB=//p')
MEX = $(MATLAB)/bin/mex
0

According to the official answer of MathWorks (See Where is MATLAB installed on my machine?) it is located in - \usr\local\MATLAB\Rxxxxx where xxxxx stands for the version. For instance R2019a for the version released in March 2019.

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.