Is it possible to use this for Matlab Embedded Functions? I am trying to solve a problem where I have a model for xPC/Simulink and passing Structures is not supported. I've tried techniques where I convert Structures from the workspace into Arrays then in the model I convert it back to a struct into a Matlab Function using Bus building blocks. The problem is that I need to know the format of the struct ahead of time and my struct can change. This looks like a great approach and I wonder how I can apply this to Simulink Matlab Embedded Function some how.
I encountered the exact same name collision problem that Christian Dorion mentioned in his comment below. If I unpack a structure in a function, and one of the resulting variable names is also a function name (it was "ngrid" in my case), then Matlab interprets the variable name as a function call. The strangest think is that if I do a "who" or "which" within the function, then Matlab correctly reports that ngrid is a variable. But then it fails to interpret it correctly. I have a very hard time coming up with an explanation for this behavior. Anyone?