How to replace statements in Matlab functions for code generation?
显示 更早的评论
I would like to have optional code in a functions which is used for autocoding. This should be similar to preprocessor/compiler directives in C/C++. For example:
%#if CODEGEN
a = someFunctionNotCodeGenerationCapable(b);
%#else
a = simplifiedFunctionCodeGenerationCapable(b);
%#endif
This would allow to have a simulation in Matlab with more sophisticated functions e.g. GUI which may prevent code generation.
When code is generated it should be replace by another function for which code can be generated,
回答(1 个)
Steven Lord
2023-10-20
0 个投票
Are you hoping to do code replacement? Or are you thinking of something smaller like checking coder.target to see if you're in MATLAB or generating code for a specific target?
类别
在 帮助中心 和 File Exchange 中查找有关 MATLAB Coder 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!