フィルターのクリア

MATLAB_MEX_FILE undefine is ignored

2 ビュー (過去 30 日間)
Nils Herjürgen
Nils Herjürgen 2018 年 8 月 22 日
回答済み: shitao zhan 2018 年 12 月 11 日
Hello,
i am currently writing some s-functions that i also want to use with embedded coder to generate c-code. I use the sfuntmpl_basic.c template and adapt it to my needs (say sfun.c). Then i compile it via
mex sfun.c
to a mex-file. I also use a tlc-file to inline my s-function. In Simulink i use the s-function block and refer it to sfun.c. I want to include a header, say testsim.h, but only for simulation and not for code generation. So in sfun.c i coded:
#ifdef MATLAB_MEX_FILE
#include "testsim.h"
#endif
The simulation works fine, however in the generated code testsim.h is included even MATLAB_MEX_FILE should be undefined now, shouldn't it? What am i doing wrong?
Btw, what actually happens when i press the build button in simulink? Does it take my sfun.c, preprocesses it, compiles it, runs it, interprets the tlc-file and somehow generates the code with the outcomes?
Thank you in advance!

回答 (1 件)

shitao zhan
shitao zhan 2018 年 12 月 11 日
I met the same problem,which makes me freak, have you already got some solution?

カテゴリ

Help Center および File ExchangeSimulink Coder についてさらに検索

製品


リリース

R2017b

Community Treasure Hunt

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

Start Hunting!

Translated by