| Real-Time Workshop User's Guide | ![]() |
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.
Note that sample times propagation for the S-function code format is slightly different from the other code formats. A generated S-Function block will inherit its sample time from the model in which it is placed if no blocks in the original model specify their sample times.
| The S-Function Target | Intellectual Property Protection | ![]() |