Writing Noninlined S-Functions

About Noninlined S-Functions

Noninlined S-functions are identified by the absence of an sfunction.tlc file for your S-function. The filename varies depending on your platform. For example, on a 32–bit Microsoft® Windows® system, the file name would be sfunction.mexw32. . Type mexext in the MATLAB® Command Window to see which extension your system uses.

When you place a noninlined S-function in a model, the code generator supports only the following MATLAB API functions:

Noninlined S-Function Parameter Type Limitations

Parameters to noninlined S-functions can be of the following types only:

For more flexibility in the type of parameters you can supply to S-functions or the operations in the S-function, inline your S-function and consider using an mdlRTW S-function routine.

Use of other functions from the MATLAB matrix.h API or other MATLAB APIs, such as mex.h and mat.h, is not supported. If you call unsupported APIs from an S-function source file, compiler errors occur. See the file matlabroot/rtw/c/src/rt_matrx.h(.c) for details on supported MATLAB API functions.

If you use mxGetPr on an empty matrix, the function does not return NULL; rather, it returns a random value. Therefore, you should protect calls to mxGetPr with mxIsEmpty.

  


 © 1984-2008- The MathWorks, Inc.    -   Site Help   -   Patents   -   Trademarks   -   Privacy Policy   -   Preventing Piracy   -   RSS