Skip to content
Jesús Briales edited this page Feb 24, 2015 · 8 revisions

MRPT Matlab bindings

Compilation with Matlab support

Firstly, BUILD_MATLAB option in Cmake should be activated in order to add all MRPT-Matlab functionalities and access different options.

Once BUILD_MATLAB is activated, a new group of options MATLAB will appear. Currently the Cmake script is automated to look for MATLAB installation in its usual folder and take the latest version. If some problem happens the necessary paths should be given by hand.

The different available MEX applications to build are given with the prefix BUILD_MEX_

Some available applications

  1. mex-grabber A wrapper for usual rawlog-grabber app which allows to initialize any device supported by MRPT and take reads from Matlab.

How to add new MRPT-MATLAB I/O interface in a MRPT class class_name

  1. In the class_name header file:
  • Add DECLARE_MEX_CONVERSION macro inside class definition to declare writeToMatlab virtual method.
  • Add DECLARE_MEXPLUS_FROM(class_name) outside class definition to specialize mexplus::from template function with a customized version (to write in the implementation file of class_name).
  1. In the class_name implementation file (and always with #if MRPT_HAS_MATLAB directive!)
  • Add IMPLEMENTS_MEXPLUS_FROM(class_name) to set a call to the class method writeToMatlab when the function mexplus::from is called with class_name argument.
  • Write custom implementation for writeToMatlab method. Here there is an example of typical implementation: