This repository serves as a quick introduction to show how Matlab functions can generated to C/C++ code using Matlabs Codegen tool.
Place the Matlab code you want to autogenerate in a folder under matlab_code/<your_project>
similarly to example_for_readme
.
├── CMakeLists.txt
├── generate_code.m
├── matlab_code
│ └── example_for_readme
│ ├── Addition.m
│ └── main_addition_test.cpp
└── README.md
Then, by running generate_code.m
, the autogenerated code will appear in a new folder called ./Addition
. Inside generate_code.m
you have to specify the input/output structure of the function you want to generate.
Open up a terminal in this folder and run
mkdir build
cd build
cmake ..
./main_addition_test
to run the autogenerated code example.