Troubleshooting

Before beginning the troubleshooting, check that MATLink has been set up according to the installation instructions, that you are using the latest MATLink version, and that your system meets the necessary requirements. Please also see the list of known issues. Once you've done that, read the following carefully, and see if your specific issue is covered.

If your issue is not resolved by the links below, please post a question on Mathematica Stack Exchange and tag it with matlink. Please include the output of the command MATLink`Developer`GetInfo[].

Common issues

This error occurs when upgrading to a newer version of MATLink and a new option has been added. To fix this issue, please run MATLink`Developer`ResetSettings[] and restart MATLink.

Operating system specific issues

Each OS has a set of necessary steps (some of which might be set by default, depending on your configuration), which were previously described in the installation instructions, and a set of frequently encountered issues.

Windows

Necessary steps

FAQ

Make sure you have followed the installation instructions and added MATLAB's bin\win64 (bin\win32 directory if MATLAB is 32-bit) to the operating system's PATH environment variable. These directories are located within MATLAB's installation directory. A typical location would be

C:\Program Files\MATLAB\R2013a\bin\win64

Pay special attention not to accidentally add any spaces on either side of the ; separator characters when editing the PATH variable.

After editing the system path, restart Mathematica (including the Front End). You can verify that the directory is indeed present in the PATH variable by evaluating Environment["PATH"] in Mathematica.

This error may indicate that you are using a 64-bit version of Mathematica with a 32-bit version of MATLAB. Note that student versions of MATLAB R2013b or earlier on Windows are only available in 32-bit.

To be able to use a 32-bit MATLAB with a 64-bit Mathematica, evaluate the following:

Needs["MATLink`"]
SetOptions[MATLink, "Force32BitEngine" -> True]

The error may also indicate that "Force32BitEngine" was accidentally set to True, even though your version of MATLAB is 64-bit. If this is the case, set it back to False.

When MATLAB is updated to a newer version, some of the MATLink installation steps need to be performed again:

  • Remove the old MATLAB version's bin\win64 directory from the system's PATH environment variable, and add the new one. It is important that only a single MATLAB version is present in the system PATH.
  • Register the new MATLAB version as COM server by running it as administrator and evaluating regmatlabserver from the MATLAB command prompt. It is important that the same MATLAB version that is added to the PATH should be registered as COM server as well.

If you used a student version of MATLAB earlier than R2014a on Windows, it was a 32-bit version. R2014a is available for Windows in 64-bit as a student version. If updating a 32-bit version to a 64-bit version, it is necessary to change this setting in MATLink as well: SetOptions[MATLink, "Force32BitEngine" -> False].

LabView is known to install tbb.dll in the C:\Windows\System32 directory. When starting MATLAB though MATLink, MATLAB tries to load this incompatible version of tbb.dll, which causes the following error:


The procedure entry point ?throw_exception_v4@internal@tbb@@YAXW4exception_id@12@@Z could not be located in the dynamic link library tbb.dll

Removing tbb.dll from C:\Windows\System32 solves this problem, but the effects on LabView are not clear. Do keep a backup of tbb.dll.

When OpenMATLAB[] hangs on Windows, it is typically accompanied by an error message shown in a popup windows. This popup window may be hidden behind other open windows, for example behind a Mathematica notebook. Please check carefully for such error dialogs. If you found an error message, please review again the list of troubleshooting topics on this page to see if there is already a solution.

Linux

Necessary steps

FAQ

Linux binaries of mengine are not included in the download package, and MATLink relies on automatic compilation instead. The error indicates that this has failed.

First, make sure that you have a recent version of g++ installed, which is compatible with your version of MATLAB. To see what is going wrong during compilation, try compiling mengine manually:

  • Open a terminal and navigate to the directory MATLink/Engine/src.
  • Run make -f Makefile.lin64 (or make -f Makefile.lin32).

If the errors shown don't give an indication of what is going wrong, send an email to matlink.m@gmail.com.

There are two distinct problems that can cause this symptom:

1. csh is not installed:

Make sure csh is installed, as it is required by MATLAB's Engine interface. On Ubuntu, it can be installed using sudo apt-get install csh.

2. mengine failed to launch:

OpenMATLAB[] will hang if the mengine.sh script fails to launch the binary executable mengine. The most common cause for this is that it cannot find the shared libraries it needs from either Mathematica or MATLAB. Try launching mengine.sh manually from the terminal and see if it complains about missing libraries. If it is working correctly, you should see a prompt Create link:. At this prompt press enter twice to exit.

If MATLAB has been upgraded to a newer version, it may be necessary to recompile mengine. Do this by evaluating the following in a fresh Mathematica kernel:

Needs["MATLink`"]
MATLink`Developer`CompileMEngine[]

OS X

Necessary steps

FAQ

This typically indicates that the mengine.sh script failed to launch the binary executable mengine. The most common cause for this is that it cannot find the shared libraries it needs from either Mathematica or MATLAB. Try launching mengine.sh manually from the terminal and see if it complains about missing libraries. If it is working correctly, you should see a prompt Create link:. At this prompt press enter twice to exit.

We do not have access to 32-bit OS X systems, so we can't provide binaries for them. If you are using such an old system, you will need to compile mengine yourself, and place the resulting binary in MATLink/Engine/bin/MacOSX32/. You will also need to provide an mengine.sh script that sets PATH and DYLD_LIBRARY_PATH before launching mengine. Please see the model in MATLink/Engine/bin/MacOSX64/.

If you need assistance, send an e-mail to matlink.m@gmail.com.