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

Respuestas (2)

Kaustubha Govind
Kaustubha Govind el 12 de Nov. de 2012
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
Azzi Abdelmalek el 12 de Nov. de 2012
What if you use these struct variables as globals

Categorías

Productos

Preguntada:

el 12 de Nov. de 2012

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by