Using data struct in Simulink Embedded Matlab function
Show older comments
Hey guys,
I have a problem similar to the one described here:
Unfortunately when I tried the suggested solution, it only worked for simple variables but not for structs. I want to use Simulink embedded matlab functions in multiple cases. For each case I want some specific variables (which I have initialised in a script) to be know to those embedded functions. Using the suggested callback Funktion and passing the variables from the .mat I created to the simulink block worked just fine. But when I tried to pass a struct instead of seperate variables I couldn't make it work.
After trying many things, I created a bus object and passed that to the embedded function. This procedere worked but is not applicable in my case, since it is a really messy thing for so many variables.
Isn't there a better solution?
THX for your help
Answers (2)
Kaustubha Govind
on 12 Nov 2012
1 vote
Simulink Buses are the only way to create structure signals in Simulink, so unfortunately, the only solution is to create a Simulink.Bus object for each structure type that you need to use.
Azzi Abdelmalek
on 12 Nov 2012
0 votes
What if you use these struct variables as globals
Categories
Find more on Interactive Model Editing 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!