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

조회 수: 1 (최근 30일)
I would like to include a custom library in the generated code instead of the original library that Stateflow Coder includes.

채택된 답변

MathWorks Support Team
MathWorks Support Team 2009년 6월 27일
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.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Model Configuration Set Customization에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by