I have an embedded MATLAB function in my Simulink model that loads a MATLAB structure from the workspace as a parameter to use inside the m-function it calls. The size and values of the data in the structure do not change. However, the initialization phase for this MATLAB function is slow. Is there a faster or more efficient way to pass the MATLAB structure into my function? I would like to avoid having to change the format of the data in the structure if possible (it has 2 sub-structures and some vectors inside it).
I'm running this sim using Simulink Accelerator and it recompiles every time I run the model, so while the init time decreases after the first time the sim is recompiled after any changes, there is still a time penalty incurred on each run.