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!