From: Laura on
Hello,

I have a fairly complex c function that I need to call in simulink using the legacy code tool. Specifically, this function returns multiple outputs by expedient of passing in a structure variable by reference. Within the function, the values in this structure are updated. When I use this function within a c library, the calling program then grabs the updated values to finish whatever processing is required.

Now, I'd like to be able to call this function from a simulink model. However, according to the documentation at "http://www.mathworks.com/access/helpdesk/help/toolbox/simulink/sfg/bq4g1es-1.html#bq4g1es-6" on how to do so, I cannot actually do this because the function must not change the value of of input arguments, and that is what I end up doing. Nor can I modify my function to return a reference to the output structure, since the same rules state I can't have a function return a pointer.

Now, I don't see anything that indicates I can't simply return the output structure directly, but I can't seem to find any directions on how this is actually done. Can someone point me to an example? For that matter, are there any examples of using the legacy code tool with pointers to structures as inputs to a function?

Thanks,
Laura
 | 
Pages: 1
Prev: boundary detection
Next: GNLSE source code