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:
edit ~/.matlab/R2014a/mex_C++_glnxa64.xml (or similar filename, depends on your system architecture,
you probably need to remove write protection first, a prior backup is suggested)
Insert "-std=c++11" and remove "-ansi" instead in the line starting with
Add "-Wl,-rpath=." in the line starting with
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 ./make.sh
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 'make.sh' 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
- Open MATLAB
- change directory to 'matlab_examples'
- run one of the examples, e.g. 'example_rof'
- try more examples documented here.