Problem with non tunable parameters of embedded matlab function
显示 更早的评论
I'm using Matlab/Simulink R2011b with the 'Embedded Coder'. In my Simulink model is an embedded matlab function that runs with inputs and outputs and several parameters such as data fields. If I use 'Simulink.Parameter' as parameters for the embedded matlab function, it works fine and the option 'inline parameters' in embedded coder works properly. If I look the generated C code, I see the function prototype with the parameters that were replaced by numerical values and they are const, because I do not want to change them, so I unchecked the tunable checkbox, they shall stay untunable. All the 'Simulink.Parameters' are in my base workspace and defined for storage class as 'Auto'. This constellation works fine, no warnigs or errors at all.
I want to group my parameters in my workspace, so I create a structure with all the data fields. These fields are my parameters, but it is a normal structure. Then I create a 'Simulink.Parameter' and assign the structure to the 'Value' of a 'Simulink.Parameter'. Now, I have only one parameter for my embedded matlab function that defined as Simulink.Parameter. Everything works fine, no warnigs or errors at all. If I look into the generated C code I see that the function prototype looks different. It seems that the option 'Inline parameters' does not work in that case. The data fields are now a structure referenced by a pointer. The name of the structure is generated by Embedded Coder. I choosed the same options for 'Simulink.Parameter'. How can I resolve that problem? I want only group my parameters with the advantage of inlining. Does the option 'Inline Parameters' not work with structures? I have a workaround with a script, but it is not a good solution. Is it an issue of Embedded Coder or there is now other solution for that?
Best regards, Daniel.
回答(3 个)
TAB
2013-1-31
0 个投票
I tried same thing and found that it is working properly.
Daniel Wolkow
2013-3-6
0 个投票
1 个评论
Ahmad Asafi
2022-8-25
please how did you change the parameter from non tunable to tunabe ?
类别
在 帮助中心 和 File Exchange 中查找有关 Simulink Coder 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!