How can i use C code generated by simulink in external environment?

2 views (last 30 days)
Hello Folks,
i want to integrate a Simulink Model in an LabView embedded target.
I already managed to to build the linux equivalent of a .dll, a shared library from a Matlab function. The scope was to have a kalman filter algorithm designed in Matlab running on that mentioned embedded target. Matlab Coder generated me a bunch of C code i was able to load in a National Instruments provided IDE (Eclipse) for cross compiling. In result i got an .so library file. This file has a main-function in the style "void main(int x, int y,int *z)" which i then can call periodically from within Labview by naming the function, the I/O's and the .so library file.
According to this my question is the following: I recognized that the interface for the generated C code out of Simulink is a little more complex. Is there a way to have a kind of wrapper around the generated code to access it with a single function call. Also this call needs to be periodically. At some point of the LabView programm i want to pass model inputs to the model, run one step and proceed with the LabView programm.
I hope i have clearly outlined my concern and are happy about your answers!
Johann

Answers (1)

Ning Zhang
Ning Zhang on 19 Sep 2016
Hi Johann,
I understand that you want to use generated code in an external environment.
Just follow the instruction of this documentation and then modify the "ert_main.c" file as you wish in an IDE. http://www.mathworks.com/help/ecoder/ug/generating-code-using-embedded-coder.html
This following video might be exactly what you need: https://www.youtube.com/watch?v=GZVcpep8cxE

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!