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

조회 수: 4 (최근 30일)
Johann Skatulla
Johann Skatulla 2016년 9월 11일
답변: Ning Zhang 2016년 9월 19일
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

답변 (1개)

Ning Zhang
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
This following video might be exactly what you need: https://www.youtube.com/watch?v=GZVcpep8cxE

카테고리

Help CenterFile Exchange에서 Naming Conventions에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by