MATLAB Coder: Option "generate one file for each MATLAB file"
古いコメントを表示
Hello, I want to produce C/C++ standalone Code with MATLAB Coder. Although i took the option "generate one file for each MATLAB file" some MATLAB files are translated together in one C/C++ file. Is there another option to take influence on that? Kind regards Andreas
6 件のコメント
Carl
2017 年 8 月 24 日
Hi Andreas. Can you provide an example of when this happens? For example, two .M files that MATLAB Coder will combine into a single file, even with the "generate one file for each MATLAB file" option selected.
Andreas Schröffer
2017 年 8 月 25 日
Carl
2017 年 8 月 25 日
For MATLAB Coder to generate separate files for fcn2, you will need to provide it as an entry-point function. Otherwise, like you observed, its functionality will simply get integrated into fcn1. Is there a specific use case for which you want to define fcn1 as an entry-point function, but not fcn2? For example, are you trying to have code generated for fcn2, but only accessible within fcn1.c?
Andreas Schröffer
2017 年 8 月 26 日
Carl
2017 年 8 月 28 日
Thanks for following up. To prevent MATLAB Coder from inlining a function, you can use the line "coder.inline('never')". For example:
function b = fcn2(a)
coder.inline('never')
b = a + 1;
end
This will prevent fcn2 from being inlined in fcn1.
Andreas Schröffer
2017 年 8 月 30 日
採用された回答
その他の回答 (0 件)
カテゴリ
ヘルプ センター および File Exchange で ARM Cortex-A Processors についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!