Stateflow User's Guide Previous page   Next Page

Calling the abs Function

Stateflow extends the interpretation of its abs function beyond the standard C version to include integer and floating-point arguments of all types as follows:

If you want to use the abs function in Stateflow in the strict sense of standard C, be sure to cast its argument or return values to integer types. See Type Cast Operations.

Calling min and max Functions

Although min and max are not C library functions, Stateflow enables them by emitting the following macros automatically at the top of generated code.

To allow compatibility with user graphical functions named min() or max(), Stateflow generates code for them with a mangled name of the following form: <prefix>_min. However, if you export min() or max() graphical functions to other Stateflow charts in the Stateflow machine, the name of these functions can no longer be emitted with mangled names in generated code and conflict occurs. To avoid this conflict, rename the min() and max() graphical functions.


Previous page  Calling C Functions in Actions Calling User-Written C Code Functions Next page

© 1994-2005 The MathWorks, Inc.