When generating an s-function from a simulink block, can I select fields within an input structure to make them tunable parameters which show up within the s-functions mask?
9 views (last 30 days)
Show older comments
Jeremy Bauman
on 25 Feb 2022
Commented: Jeremy Bauman
on 28 Feb 2022
I'm really just curious if there is a simple way to make tunable parameters from individual fields within structures that are passed into a simulink block when generating an s-function. What I'm looking for is something analgous to how you would normally select an input as a tunable parameter when generating an s-function, which then shows up in your s-functions simulink block mask. However, with passing workspace structures into the simulink block, it seems like you can select the structure as tunable and the generated code seems to provied a path to make the underlying fields tunable. However, I can't seem to find a simple way for this structure information to show up within my mask, that is, without having to do some code editing and recompiling, which I'm trying to avoid.
0 Comments
Accepted Answer
Benjamin Thompson
on 25 Feb 2022
It seems possible, according to this article in the Mathworks documentation, "Organize Data into Structures in Generated Code".
Your comment about passing individual fields of a structure to an S-Function as tunable parameters could be problematic, as I seem to remember that the "." operator was in the list of operators making an expression non-tunable. Right now I cannot lay my mouse on that article in the documentation. If you have success please post a followup comment.
More Answers (0)
See Also
Categories
Find more on Simulink Coder 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!