Using data struct in Simulink Embedded Matlab function
显示 更早的评论
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
回答(2 个)
Kaustubha Govind
2012-11-12
1 个投票
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
2012-11-12
0 个投票
What if you use these struct variables as globals
类别
在 帮助中心 和 File Exchange 中查找有关 Interactive Model Editing 的更多信息
产品
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!