Simulink: Generate s-Function - Parameterize?
Show older comments
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
Answers (1)
Kaustubha Govind
on 4 Sep 2012
1 vote
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.
Categories
Find more on Simulink Coder in Help Center and File Exchange
Products
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!