How to write into the memory locations of the paramater using C api?

조회 수: 1 (최근 30일)
Sahana B S
Sahana B S 2017년 1월 12일
답변: Jordan Ross 2017년 1월 23일
Hi, I am working on developing a wireless bridge for ECU communication using simulink code gereration, there are few parameters which needs to be given by the user during run time using keyboard before invoking the actual model. I have generated C api for my model to access the addresses of the paramaters along with the generated c code. But I dont know how to develop program to write into these memory locations of the paramater using C api. Can any one please tell me how I can use matlab generated C api to develop my front end application code to write values into the parameter's memory locations in real-time. Thanks in advance!

답변 (1개)

Jordan Ross
Jordan Ross 2017년 1월 23일
Hello Sahana,
As I understand, you have some parameters that need to be defined before you run the model. Instead of writing to the memory locations as your are talking about you can just set the parameters to be "Tunable " in the codegen settings. You can do this by doing the following:
  1. Assign a MATLAB variable or Simulink.Parameter as the parameter to the blocks that you want to tune.
  2. In the Configuration Parameters make sure the parameter "Default parameter behavior" is set to "Tunable".
  3. Then, in the generated code you should see a structure with the tunable parameters defined in the header file. You can then set the members of that structure to have the input values given at the command line.

카테고리

Help CenterFile Exchange에서 Troubleshooting in Simulink Real-Time에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by