How to make struct from workspace available in m-file s-function block?

  • Follow


Hey everybody,
I'm evaluating a function expression by using a m-file s-function within my simulink model. Therefore I offline calculate a coefficient structure and save it in the base workspace. This coefficient structure doesn't change during simulation. Online, I only need to evaluate this coefficient struct at a specific point given by two variables X and Y in order to calculate Z. X and Y change over time and depend on updated Z. 
My difficulty is the following: I would like to make the coefficient struct available within the simulink block by loading it just once from base workspace during model initialisation. Since the m-file s-function block as far as I know does not have public fields I haven't found a way to do so. Right now, I'm loading the coefficient struct from base workspace into the simulink block by using evalin('base','coefficient_struct') command at every timestep. However it gives me a hard time in means of the calculation time. I already tried to declare the structure as a global variable, but calculation time was even longer.

Does anybody of you guys know of a neat way to implement this? Either by loading the coefficient structure into the m-file s-function just once before the simulation starts and store it in the block or by loading the structure efficiently into the simulink at every timestep.

I would be grateful for any idea or proposal. Thanks a lot!
-Nils
0
Reply Nils 1/11/2010 9:09:03 AM


0 Replies
665 Views

(page loaded in 0.011 seconds)

Similiar Articles:













7/25/2012 11:52:20 PM


Reply: