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!