How can I set up "matlab coder" to produce fewer C/C++ files?

5 次查看(过去 30 天)
The problem is that I prefer to use the "matlab coder app" for C code generation and I want to produce as few C code files as possible so that I can port them later. I have found that the following settings can reduce the number of code files produced.
1, in the "matlab coder app" in the settings options, "code appearance" under the left side of the selected card "generated file partitioning method", I selected "generate all functions into a single file".
2. In the "matlab coder app", under the "speed" tab on the left hand side of the settings options, none of them are selected.
These can partially reduce the number of files, but there are more C files, I prefer to generate only a ".c" file and a corresponding ".h" file, in addition to the main example file, such as the following figure of pathLog_emxutil.c, pathLog_ emxutil.h, pathLog_types.h should be merged into pathLog.c and pathLog.h. I understand from the documentation that files with the *_emxutil.c/h suffix are generated only when dynamic memory allocation is met, so any way to minimize the generation of multiple files would be appreciated in advance!
如何设置才能使“matlab coder”生成更少的文件?
问题是这样的,我更习惯使用“matlab coder app”做C代码生成,希望生成的C代码文件尽可能少,这样方便我后续移植。据我探索发现,以下几点设置可以减少生产的代码文件数量:
1、在“matlab coder app”中的设置选项,“code appearance”左侧选下卡下有“generated file partitioning method”,我选择了“generate all functions into a single file”.
2、在“matlab coder app”中的设置选项,“speed”左侧选下卡下都不选择。
这些虽然部分可以减少一定数量的文件,但是还有较多的C文件,我更喜欢除了main示例文件外,只生成一个“.c”文件和一个对应的".h"文件,比如下图中的pathLog_emxutil.c、pathLog_emxutil.h、pathLog_types.h应该合并到pathLog.c和pathLog.h中比较好。 我从文档中了解到*_emxutil.c/h后缀的文件是满足动态内存分配时候才生成的,请问有什么办法尽量减少多个文件的生成,提前感谢!

回答(0 个)




Community Treasure Hunt

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

Start Hunting!

Translated by