| Writing S-Functions | ![]() |
Noninlined S-Functions
Noninlined S-functions are identified by the absence of an sfunction.tlc file for your S-function (sfunction.mex). When placing a noninlined S-function in a model that is to be used with the Real-Time Workshop, the following MATLAB API functions are supported:
mxGetEps
mxGetInf
mxGetM
mxGetN
mxGetNaN
mxGetPr -- Note that using mxGetPr on an empty matrix does not return NULL; rather, it returns a random value. Therefore, you should protect calls to mxGetPr with mxIsEmpty.
mxGetScalar
mxGetString
mxIsEmpty
mxIsFinite
mxIsInf
In addition, parameters to S-functions can only be of type double precision or characters contained in scalars, vectors, or 2-D matrices. To obtain more flexibility in the type of parameters you can supply to S-functions or the operations in the S-function, you need to inline your S-function and (possibly) use an mdlRTW S-function routine.
| Basic Files Required for Implementation | S-Function Module Names for Real-Time Workshop Builds | ![]() |