Real-Time Workshop | ![]() ![]() |
Introduction
Using the S-function target, you can build an S-function component and use it as an S-Function block in another model. The S-function code format used by the S-function target generates code that conforms to the Simulink C MEX S-function application programming interface (API). Applications of this format include:
m1
. Then, you can place the generated S-Function block in another model, m2
. Regenerating code for m2
does not require regenerating code for m1
.
The S-function target generates noninlined S-functions. You can generate an executable from a model that contains generated S-functions by using the generic real-time or real-time malloc targets. You cannot use the Real-Time Workshop Embedded Coder target for this purpose, since it requires inlined S-functions.
You can place a generated S-Function block into another model from which you can generate another S-function format. This allows any level of nested S-functions.
Intellectual Property Protection
In addition to the technical applications of the S-function target listed above, you can use the S-function target to protect your designs and algorithms. By generating an S-function from a proprietary model or algorithm, you can share the model's functionality without providing the source code. You need only provide the binary .dll
or MEX-file object to users.
![]() | The S-Function Target | Creating an S-Function Block from a Subsystem | ![]() |