Building the Matlab interface

Note: the Matlab interface is available for both CUDA as well as OpenCL builds.

Installing and configuring Matlab

Obviously, Matlab needs to be installed on the system, we tested with R2014a. Second, the Matlab compiler mex needs to be in current path and properly set up.

Step 1: if not done already, call

 mex -setup C++

Step 2a: the following g++ compiler options must be in use by mex


Also, the option "-ansi" must be deactivated.

Step 2b: the following g++ linker option must be used by mex


Unfortunately, g++ options for mex can only be set globally (to my knowledge - if you know another way, please tell me!). Thus, the above can be achieved by editing the mex build configuration files.

Example which works for R2014a:

For reference, here is my version of mex_C++_glnxa64.xml.

Building the interface

After mex has been set up the above way, it should be able to run the setup script for the Matlab interface as follows:

  cd matlab_interface

All targets will be created in this directory and linked to the subdirectory 'matlab_examples', where you can try stuff out.

If you have problems (e.g. libraries not found), take a look at '' and check if you can make adjustments for your system. The install script was tested only on Mint 17, but should work on most Ubuntu-related distros.

Testing the MATLAB interface