M-file Simulink pass struct data to output function

Hello, I use the "Level-2 M-file S-Function" block to call a M-File in Simulink (setup method) where I read data from a File into a struct (OpenCRG Road Data) which is then used to compute the output of the Simulinkblock.
The problem is that I only need to read the struct data once, not at every time step, so I figured the read_file_to_struct command should take place in the "DoPostPropSetup(block)" or "InitializeConditions(block)" functions.
My problem is, that I cannot find a way to pass struct data to the output(block) function, so is there a way I haven't found yet?
I guess normaly the Dwork struct is used to pass data to the output(block) function but it only seems to be meant for vector and matrix data.
Thanks
edit: global or persistent variables don't seem to work

Réponses (0)

Catégories

En savoir plus sur Simulink Coder dans Centre d'aide et File Exchange

Produits

Community Treasure Hunt

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

Start Hunting!

Translated by