Dependencies in Simulink Functions(/Function Caller)
3 views (last 30 days)
Show older comments
Hi all,
I have only just started using Simulink function and I have come across the problem of trying to 'extract' all the 'common' (/dependencies) functions (typically sin, cos, atan, mod, etc...) across different Referenced Models and place them in their own Referenced Model. The ultimate goal is to code generate a number of Reference Models along with a State Flow state machine (the application).
What I would like to have is a Reference Model, lets call it "Math_Functions" which will have a number of Simulink Functions in it, each of which will contain a Matlab function block (within which I have a single function call to the appropriate math function).
Currently these dependencies are code generated in separate source and header files per function (per sin, cos, etc...). The same function is code generated multiple times (once for every reference model it exists in), which is what I am trying to avoid.
Using Matlab 2017b.
Any help or ideas much appreciated.
Thanks and regards Alex
0 Comments
Answers (1)
Mark McBroom
on 25 Feb 2018
Best approach is to place each MATLAB Function block into an atomic subsystem and place in a Simulink library. COnfigure the atomic subsystem to generate reusable code. You will get one c function in /slprj/ert/_sharedutils. This blog gives details.
See Also
Categories
Find more on Simulink Coder in Help Center and File Exchange
Products
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!