How do I include a custom library in the generated code instead of the original library that Stateflow Coder includes?

1 Ansicht (letzte 30 Tage)
I would like to include a custom library in the generated code instead of the original library that Stateflow Coder includes.

Akzeptierte Antwort

MathWorks Support Team
MathWorks Support Team am 27 Jun. 2009
Follow the steps below to include your custom library instead of the original library:
1. If you want to replace the call to 'math.h' and replace it with your custom library 'mymath.h', open up 'math.h' privided by the compiler and look for an include guard such as that shown below.
The Microsoft provided 'math.h' contains the include guard:
#ifndef _INC_MATH
#define _INC_MATH
......
On UNIX, the include guard is as follows:
#ifndef _MATH_H
#define _MATH_H
.....
2. To customize the code generated by the Stateflow target, go to Tools => RTW Target from the Stateflow chart. Now click on the 'Target Options..' button. This will bring up a window which says "Custom Code included at the top of the generated code" at the top of a pull-down menu.
In this window, insert a #define of this include guard:
#define _INC_MATH
This tells the preprocessor not to include 'math.h' from the compiler.
Refer to the Related Solution for information on how to integrate custom C code into Stateflow.

Weitere Antworten (0)

Kategorien

Mehr zu Model Configuration Set Customization finden Sie in Help Center und File Exchange

Produkte

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by