Skip to content

borglab/gtsam-project-matlab

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

17 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

MATLAB Wrapper Example Project

This project serves as a lightweight example for demonstrating how to wrap C++ code in MATLAB using GTSAM.

Dependencies

We recommend installing the gtwrap project.

Once the repo is cloned, you can install it via:

mkdir build && cd build
cmake ..
sudo make install

Compiling

We follow the regular build procedure inside the example_project directory:

mkdir build && cd build
cmake ..
make -j8
sudo make install

sudo ldconfig  # ensures the shared object file generated is correctly loaded

If you have a custom install location, denoted by <install-path>, you need to update your LD_LIBRARY_PATH environment variable.

export LD_LIBRARY_PATH=<install-path>/gtsam:$LD_LIBRARY_PATH

Usage

Now you can open MATLAB and add the gtsam_toolbox to the MATLAB path

addpath('/usr/local/gtsam_toolbox')

At this point you are ready to run the example project. Simply run code like regular MATLAB, e.g.

pe = example.PrintExample();
pe.sayHello();
pe.sayGoodbye();

Issues

If you see the compiler issue

fatal error: wrap/matlab.h: No such file or directory
    1 | #include <wrap/matlab.h>
      |          ^~~~~~~~~~~~~~~

this means either the gtwrap project is not installed, or you are using the wrapper as provided within GTSAM. In this case, we recommend (re-)installing the gtwrap project as the easiest fix.

About

Project template using GTSAM + Matlab wrapping

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published