Azzera filtri
Azzera filtri

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

2 visualizzazioni (ultimi 30 giorni)
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?

Risposta accettata

Kaustubha Govind
Kaustubha Govind il 19 Mar 2013
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.

Più risposte (0)

Prodotti

Community Treasure Hunt

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

Start Hunting!

Translated by