MATLAB Answers

Reusable library block containing MATLAB Function block input driven by Constant block

1 ビュー (過去 30 日間)
Amr Nagaty
Amr Nagaty 2020 年 5 月 1 日
I created a Simulink library that contains an atomic subsystem configured to be reusable (SYS_MAT). That subsystem contains a Matlab Function.
I created a Simulink subsystem (SYS) that uses the library block (SYS_MAT) as a linked subsystem two times. First instance, it is driven by an input port. Second instance, it is driven by a Constant block. When I try to generate code from the Simulink subsystem (SYS) using Embedded Coder, the reusable library block generates duplicate code i.e. the function is not reused for the two instances of SYS_MAT. It seems that somehow driving the Matlab Function from a Constant block input impacts reusability.
I attached my simple test. To recreate the problem, open code_gen_test_duplication.slx, right click SYS block, C/C++ and build this subsystem. Inspect the code generation report for the dulicated code generation of SYS_MAT.c.
Please advise.

  0 件のコメント


回答 (0 件)


Community Treasure Hunt

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

Start Hunting!

Translated by