- Assign a MATLAB variable or Simulink.Parameter as the parameter to the blocks that you want to tune.
- In the Configuration Parameters make sure the parameter "Default parameter behavior" is set to "Tunable".
- 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.
How to write into the memory locations of the paramater using C api?
2 views (last 30 days)
Show older comments
Sahana B S on 12 Jan 2017
Answered: Jordan Ross on 23 Jan 2017
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!
Jordan Ross on 23 Jan 2017
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:
Find more on Modeling in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!Start Hunting!