Tuning parameters via C API
显示 更早的评论
I have created tunable parameters in my Simulink model and have compiled it using the grt. Now I would like to change the value of these parameters via an external interface. What is the function call to do this? How do I hook into the dll?
回答(1 个)
Kaustubha Govind
2011-10-19
0 个投票
You should find a parameter structure declared as "extern" in the modelname.h file. It typically has a type named something like Parameters_modelname and a variable named modelname_P, and is defined in the modelname_data.c file. You can eliminate this definition and create your own. Since this is a global variable, you can access in from anywhere in code and modify it.
You can also customize what the tunable parameter data structure looks like by choosing a different Tunable Parameter Storage Class.
This page explains how you can create your parameter as a Simulink.Parameter object and choose a storage class.
1 个评论
vcmorini
2017-7-17
Hello Kaustubha Govind, could you provide an example about changing parameters values with C API ?
It works for Simscape and Simulink?
C API is the only way to change tunable parameters values after code generation? Because I was looking at Generating Code Multibody and does not says anything about C API.
Thank you
类别
在 帮助中心 和 File Exchange 中查找有关 Run-Time Parameters 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!