Dependencies in Simulink Functions(/Function Caller)

3 Ansichten (letzte 30 Tage)
Alex Bogias
Alex Bogias am 18 Jan. 2018
Bearbeitet: Alex Bogias am 26 Feb. 2018
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

Antworten (1)

Mark McBroom
Mark McBroom am 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.
  1 Kommentar
Alex Bogias
Alex Bogias am 26 Feb. 2018
Bearbeitet: Alex Bogias am 26 Feb. 2018
Thanks for taking the time to reply Mark.I really appreciate it.
I will give your (/blog) suggestion a try.

Melden Sie sich an, um zu kommentieren.

Kategorien

Mehr zu Simulink Coder finden Sie in Help Center und File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by