How to not-optimize my code generated by Matlab coder

2 ビュー (過去 30 日間)
Lukai Cai
Lukai Cai 2018 年 2 月 27 日
コメント済み: Lukai Cai 2018 年 2 月 28 日
I have a function named top()
top()
{
f1(p1, p2, p3);
f2(p3,p4,p5);
f2(p6, p7, p8);
}
I use f2 and f1 as entry point to generate the code, and use top() as reference. But in the generated code, f1 is optimized out. f2 is generated into to version. f2_1(), and f2_2() for each f2 call respectively. It is not what I want.
I want to generate f1 and f2 as it is without changing on interface (including all the argument not changed. how the top() call f1() and f2() not changed). How to do it?
Thanks!

採用された回答

Denis Gurchenkov
Denis Gurchenkov 2018 年 2 月 27 日
編集済み: Denis Gurchenkov 2018 年 2 月 27 日
If you want to generate f1 and f2 "as is" then you need to make them to be entry points, that is,
codegen f1 -args {f1's args here} ...
codegen f2 -args {f2's args here} ...
or you can do in one go:
codegen f1 -args {...} f2 -args {...}
or you can also add top
codegen f1 -args {...} f2 -args {...} top -args {top's args}
There is no reliable way to generate code for top() as an entry point without f1, f2 being entry point as well, and have f1 and f2 have exactly the right signatures that you want.
  1 件のコメント
Lukai Cai
Lukai Cai 2018 年 2 月 28 日
Thanks! It works for me. Thanks for the suggestions

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

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

タグ

製品

Community Treasure Hunt

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

Start Hunting!

Translated by