How to replace statements in Matlab functions for code generation?
3 views (last 30 days)
Show older comments
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,
0 Comments
Answers (1)
Steven Lord
on 20 Oct 2023
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?
See Also
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!