Struct as Tunable Parameter in Simulink Real-Time C API
3 views (last 30 days)
Show older comments
Background
I am using both Simulink Real-Time Explorer as well as the Simulink Real-Time C API. Eventually, I want to fully switch to the C API, however, for now I am using Eplorer to test and debug my models.
I was expecting both to behave (about) the same. A mismatch arises, though, when I am using a struct as tunable parameter. In Simulink Real-Time, the struct is visible and tunable as expected. However, from the C API, only boolean/double data types are visible, not the structs.
More digging into the problem shows below result. Even from within MATLAB, 'NumParameters' is '3' (the amount of parameters not counting the structs), but the parameters shown does include the structs. When requesting the parameter ID for a struct parameter, no result is returned.
Question
This leads me to think there is a special way to retrieve the structs. Is it possible to access struct parameters from the Simulink Real-Time C API? Or otherwise access struct parameters programatically (e.g. the MATLAB command line)?
Example code
Showing parameter names from the MATLAB command line. 'NumParameters' == 3, but more are shown.
>> tg = slrt;
>> tg.ShowParameters = 'on';
>> tg
Target: VirtualBox
...
NumParameters = 3
ShowParameters = on
Parameters = VALUE TYPE SIZE PARAMETER NAME BLOCK NAME
[...] STRUCT Scalar param1
[...] STRUCT Scalar param2
[...] STRUCT Scalar param3
298.15 DOUBLE Scalar param4
[...] STRUCT Scalar parma5
[...] STRUCT Scalar param6
1 BOOLEAN Scalar param7
0 BOOLEAN Scalar param8
Retrieving the parameter ID of a struct parameter is not possible.
>> tg.getparamid('', 'param3')
ans =
[]
0 Comments
Answers (0)
See Also
Categories
Find more on Target Computer Setup 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!