| Stateflow User's Guide | ![]() |
Calling C Functions in Actions
This section describes the C functions that you can call directly in Stateflow action language. See the following topics:
Calling C Library Functions
You can call the following small subset of the C Math Library functions:
abs |
acos |
asin |
atan |
atan2 |
ceil |
cos |
cosh |
exp |
fabs |
floor |
fmod |
labs |
ldexp |
log |
log10 |
pow |
rand |
sin |
sinh |
sqrt |
tan |
tanh |
Stateflow extends the |
You can call the above C Math Library functions without doing anything special as long as you are careful to call them with the right data types. In case of a type mismatch, Stateflow replaces the input argument with a cast of the original argument to the expected type. For example, if you call the sin function with an integer argument, Stateflow replaces the argument with a cast of the original argument to a floating-point number of type double.
If you call other C library functions not specified above, be sure to include the appropriate #include... directive in the Custom code included at the top of generated code field of the Target Options dialog. See the section Specifying Custom Code Options for Stateflow Targets.
| Using Special Symbols in Actions | Calling the abs Function | ![]() |
© 1994-2005 The MathWorks, Inc.