https://github.com/borglab/gtsam-project-matlab
Project template using GTSAM + Matlab wrapping
https://github.com/borglab/gtsam-project-matlab
Last synced: about 1 year ago
JSON representation
Project template using GTSAM + Matlab wrapping
- Host: GitHub
- URL: https://github.com/borglab/gtsam-project-matlab
- Owner: borglab
- License: bsd-2-clause
- Created: 2021-03-09T21:12:06.000Z (over 5 years ago)
- Default Branch: main
- Last Pushed: 2024-02-22T20:21:40.000Z (over 2 years ago)
- Last Synced: 2025-06-21T09:06:41.284Z (about 1 year ago)
- Language: C++
- Size: 25.4 KB
- Stars: 4
- Watchers: 6
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# 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](https://github.com/borglab/wrap) project.
Once the repo is cloned, you can install it via:
```sh
mkdir build && cd build
cmake ..
sudo make install
```
## Compiling
We follow the regular build procedure inside the `example_project` directory:
```sh
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 ``, you need to update your `LD_LIBRARY_PATH` environment variable.
```sh
export LD_LIBRARY_PATH=/gtsam:$LD_LIBRARY_PATH
```
## Usage
Now you can open MATLAB and add the `gtsam_toolbox` to the MATLAB path
```matlab
addpath('/usr/local/gtsam_toolbox')
```
At this point you are ready to run the example project. Simply run code like regular MATLAB, e.g.
```matlab
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
| ^~~~~~~~~~~~~~~
```
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.