Embedded Coder - How to generate code without optimizations?

Hello ,
I want to generate C Code from my simulink model (with embedded coder).
In my simulink model there are 4 MATLAB Function Blocks and I want to generate 4 functions with input and output.
With the standard configuration the embedded coder generates a single big function with no input and output.
How can I improve my code generation with functions that correspond to MATLAB block functions?
Thanks

 採用された回答

stozaki
stozaki 2020 年 9 月 23 日

1 投票

Hello Giuseppe,
Subsystems, such as the MATLAB Function block, generate inlined code by default.
If you want the subsystem to be an independent function, change the code generation options to allow arguments.
stozaki

4 件のコメント

Giuseppe Narracci
Giuseppe Narracci 2020 年 9 月 24 日
編集済み: Giuseppe Narracci 2020 年 9 月 24 日
Hello stozaki!
thank you for you response. It helped me a lot and it works.
But if I want to return a value? how can I do it instead of working on real_T *rty_y?
In this case I want:
real_T m1_mf1(real_T);
stozaki
stozaki 2020 年 9 月 28 日
Hello Giuseppe,
Which MATLAB version are you using?
Giuseppe Narracci
Giuseppe Narracci 2020 年 10 月 6 日
2020a
stozaki
stozaki 2020 年 10 月 8 日
編集済み: stozaki 2020 年 10 月 8 日
Hello
You can change the argument settings from the code mapping editor. And You can change the C return argument from void to output such as y.

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

その他の回答 (0 件)

カテゴリ

ヘルプ センター および File ExchangeSimulink Coder についてさらに検索

質問済み:

2020 年 9 月 22 日

編集済み:

2020 年 10 月 8 日

Community Treasure Hunt

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

Start Hunting!

Translated by