How can i use C code generated by simulink in external environment?
4 次查看(过去 30 天)
显示 更早的评论
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
0 个评论
回答(1 个)
Ning Zhang
2016-9-19
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
To build a project in Eclipse IDE, check out this example: http://www.mathworks.com/examples/simulink-coder/mw/ecoder-ex39262832-integrate-generated-code-with-custom-code-in-an-external-environment#9
This following video might be exactly what you need: https://www.youtube.com/watch?v=GZVcpep8cxE
0 个评论
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Naming Conventions 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!