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

1 visualizzazione (ultimi 30 giorni)
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!

Risposte (1)

Jordan Ross
Jordan Ross il 23 Gen 2017
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.

Categorie

Scopri di più su Simulink Coder in Help Center e File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by