STL and Simulink Coder

조회 수: 5 (최근 30일)
James Dwulit
James Dwulit 2011년 5월 5일
답변: Anshuman 2024년 12월 4일
How can I use STL with Simulink Coder? In particular I need to access a deque.
  댓글 수: 1
Kaustubha Govind
Kaustubha Govind 2011년 5월 5일
Do you mean that you want to access a deque in a Simulink block? Or do you want to pass in elements from a deque to code generated using Simulink Coder?

댓글을 달려면 로그인하십시오.

답변 (1개)

Anshuman
Anshuman 2024년 12월 4일
Hi James,
If you're trying to incorporate custom C++ code, including STL containers like std::deque, into your Simulink models, you can use S-Functions in your Simulink model. S-Functions allow you to integrate custom C/C++ code into Simulink. You can write an S-Function in C++ and use STL containers inside it.
  • Create a C++ source file where you include the necessary STL headers and define functions to interact with std::deque.
  • Write an S-Function wrapper in C/C++ that calls the C++ functions you've defined.
  • Use the 'mex' command to compile the S-Function.
  • Add the compiled S-Function to your Simulink model.
  • Set up the inputs and outputs of the S-Function to match your C++ functions.
For more detailed information, pleaese refer to this documentation:
Hope it helps!

카테고리

Help CenterFile Exchange에서 Simulink Coder에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by