Simulink: Generate s-Function - Parameterize?
显示 更早的评论
Hi,
I have got the following problem: I need to provide a Simulink model to one of our customers and the content should be hidden/protected. The model exists as a Simulink subsystem. I found to possibility to create a mexw64-s-Function by clicking the right-mouse button on the subsystem -> Code Generation -> Generate s-Function. But the main issue is now that I need parameterize the s-Function, either by using the workspace, importing mat-files or whatever. I mean, for instance I have one gain block, which requires a parameter, inside the subsystem. The best solution would be to provide the parameter in a form like you can for a masked subsystem. When I generate the s-function Matlab/Simulink automatically evaluates the variable from the workspace and put the value as hard-coded into the s-function, so that I am not able to change the parameter since it is a constant now.
Can anyone help me with that? (I need a protected version of one subsystem that is parameterizable sonehow)
Thank you in advance, Chris
回答(1 个)
Kaustubha Govind
2012-9-4
1 个投票
I haven't personally done this before, but based on this solution you need to create Simulink.Parameter objects and set them as the values for all the tunable parameters in your subsystem.
类别
在 帮助中心 和 File Exchange 中查找有关 Simulink Coder 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!