MATLAB Answers


What is the default installation path for Matlab on architecture X?

Asked by Hilton
on 10 Mar 2013
Hi all!
I'm in the process of writing a new FindMatlab.cmake file, as all the versions I've found on the internet have woeful limitations (don't work on Mac, only work for Matlab v7, etc). As part of this, I need a list of install locations for different architectures. As Mathworks doesn't seem to advertise this anywhere, I thought I would try to crowd-source it.
This is where you come in!
Please reply with the full path to the matlab executable on your system. For example, on my Mac this would be: /Applications/
The architectures I'm looking for are: win32, win64, mac, maci, maci64, glnx, glnx64, sol, sol64, a64. If you have something more exotic, please let me know! The more comprehensive the list, the better FindMatlab.cmake can work :)
Thanks heaps!

  1 Comment

Have you thought about contacting technical support?

Sign in to comment.

4 Answers

Answer by Jason Ross
on 11 Mar 2013
Edited by Jason Ross
on 11 Mar 2013
 Accepted Answer

Install locations have defaults, but these defaults can (and are) changed all the time for various reasons. It's not "advertised", since the OS defaults are used, but then the end-user actually makes the decision where to install the application, like pretty much every other software product -- so there's no way of being 100% accurate in knowing where someone installed it, but that's not going to always be correct.
Also, since installation locations are entirely changeable, be sure to include a "I give up, tell me where your MATLAB is" option. It's also entirely possible to have multiple versions installed, as well -- so discovery of multiple versions and/or an override to specify the one you want is also important.
On Mac, the default is to put it in Applications. But given that OSX is more unix-y, I'd try a command like "which matlab".
On Windows, it goes in Program Files (win32/win64), or Program Files (x86) (32-bit install on 64-bit machine). If I were trying to find an installed anything on Windows, though, I'd use the APIs for Installed Programs and then get the information programmatically, as you don't have to use Program Files or Program Files (x86), and installations may be somewhere else entirely for a multitude of reasons.
On Linux/UNIX:
(glnx86/glnxa64/sol2/hpux ...), you might look in /opt /usr/bin, /bin, /local, or call "which matlab" and see if you get something -- which you may not, as there may be several MATLABs available to people, and they might need to use an alias or run some sort of script to set their environment before starting MATLAB. This platform gets tricky fast, though, as each vendor/distro might have their own place that's their favorite -- and that favorite might be entirely ignored because the application is installed on a NFS mount with a symlink to /usr/bin.


Show 1 older comment
I seem to recall that /local/... is filled in when I do install it, but that may be bad memory on my part -- and I always change it. Linux allows so many options for installation and/or deployment that it would be really difficult/impossible/slow to determine programatically.
This is great Jason! I realise there's not always a default install location on some architectures, but there is generally some rhyme or reason behind where people tend to put things. I'm already searching all the paths you suggested, so it's good to know I'm on the right track. (Never used Windows before though, so using Installed Programs APIs sounds fun...)
Regarding "which matlab", on both my Mac and my work cluster Matlab isn't on the path, so I don't necessarily see this as a reliable solution, but I guess I can always add it as an option.
No problem ... the WMI class is called Win32_Product. There is a lot of information out there about how to use it with a lot of different programming languages. Once you know something is installed there are also ways to find the associated information like installation location.
Also, keep in mind that my participation here is as a volunteer. It's by no means to be construed as an official statement by MathWorks. In your reply below, the Windows and Mac ones have very easy defaults. The Linux one is going to be all over the place. I strongly encourage you to have a method to call out exactly which MATLAB you want to use, to cover the cases of an install in a non-standard location, as well as the case of multiple installations on the same machine.

Sign in to comment.

Answer by Konrad Malkowski on 12 Mar 2013

One possible approach on linux/mac would be:
> find / -name matlab
This would recursively search the file system for "matlab"
I am sure that similar functionality can be created in PERL or another scripting language.


Sign in to comment.

Answer by Hilton
on 12 Mar 2013

As quoted by a Mathworks representative:
C:\Program Files\MATLAB\<release>
C:\Program Files (x86)\MATLAB\<release> (32-bit install on 64-bit system)


Sign in to comment.