Is it possible to add a C wrapper to a SFunction?

1 次查看(过去 30 天)
Is it possible to add a C wrapper to a SFunction? How do i create the SimStrut of a particular model? Because all the functions in SFunction target have an input argument SimStruct *S. So if i have to invoke a function, then i need to pass the argument *S to it. Can you please tell me how to do it?

采纳的回答

Kaustubha Govind
Kaustubha Govind 2013-3-19
I don't believe it is currently possible to execute S-functions outside of the Simulink environment. the SimStruct data structure is allocated and managed by the Simulink Engine, and cannot be created by an external process. I would recommend that you refactor your S-function code such that the main algorithm is in a separate C-file (that is free of Simulink specific concepts like SimStruct) and call that from the S-function instead. This way, the C code can be shared by the S-function as well as other clients.

更多回答(0 个)

产品

Community Treasure Hunt

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

Start Hunting!

Translated by