Reusable library block containing MATLAB Function block input driven by Constant block
2 views (last 30 days)
Show older comments
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 Comments
Answers (0)
See Also
Categories
Find more on Subsystems in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!