Info

이 질문은 마감되었습니다. 편집하거나 답변을 올리려면 질문을 다시 여십시오.

Embedding generated C++ code into another project

조회 수: 1 (최근 30일)
PT
PT 2018년 5월 2일
마감: MATLAB Answer Bot 2021년 8월 20일
Hi,
I am trying to use the simulink generated code into another C++ project. I am using GRT.tlc which generates a visual studio project. I can run the project without errors, but I cant provide it with inputs and receive outputs. What I want to do is to use this model as a black-box function in another C++ code. I would like to have a function which looks likes- Out = MyModel(in1, in2) (or some variant of this). I am unaware of any documentation on using the generated C++ code in another hand-written project. Any help would be greatly appreciated Thank you,
Best
-PT

답변 (1개)

lokender Rawat
lokender Rawat 2018년 5월 8일
편집: lokender Rawat 2018년 5월 8일
Follow the steps below to achieve your goal of embedding c++ code in another project:
1. Generate Code using GRT TLC.
2. From the generated code, create S-Function using S Function Builder.
3. Step 2 will create MEX file.
4. Use this MEX as S-Function in the model you want to use.
However, in case you want to call the generated MEX from c++ code (instead of Simulink Model), go through following document link: Call_Function

이 질문은 마감되었습니다.

Community Treasure Hunt

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

Start Hunting!

Translated by