audiofilter/mex-it
Single header file library to automatically mex C++ functions for Matlab (with C++11 compiler)
supply the mex_function and let the compiler do the rest!
This supports basic C++ data types such as std::vector. Also Eigen Matrices and Vectors
How do the compiler know the inputs and outputs?
Non-const references mean outputs
Everything else are inputs
Example
Create a c++ implementation file like this
void mex_function(const double &x, const double &y, const double &z, double& result) {
result = (x + y)*z;
}
#include "mex-it.h"
Then build with CMake or using mex within Matlab
For single file example, you can do this in matlab (for recent GCC/Clang)
mex CXXFLAGS="\$CXXFLAGS -std=c++11" simple_example.cpp
Cite As
Tony Kirke (2024). audiofilter/mex-it (https://github.com/audiofilter/mex-it), GitHub. Retrieved .
MATLAB Release Compatibility
Platform Compatibility
Windows macOS LinuxCategories
Tags
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!Discover Live Editor
Create scripts with code, output, and formatted text in a single executable document.
test
Versions that use the GitHub default branch cannot be downloaded
Version | Published | Release Notes | |
---|---|---|---|
1.8.0.0 | Better checking of data types for inputs |
|
|
1.7.0.0 | Check data types for input vectors so that 'float' isn't interpreted as 'double', etc |
|
|
1.6.0.0 | Fix compiler warnings for Windows |
|
|
1.5.0.0 | Now use single header file. |
|
|
1.4.0.0 | Update version number
|
|
|
1.3.0.0 | Bug fixes. Allow returning Eigen Vectors (as well as std::vector) to Matlab from mex
|
|
|
1.2.0.0 | Add graphic |
|
|
1.0.0.0 |
|