Dependencies in Simulink Functions(/Function Caller)

조회 수: 3 (최근 30일)
Alex Bogias
Alex Bogias 2018년 1월 18일
편집: Alex Bogias 2018년 2월 26일
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

답변 (1개)

Mark McBroom
Mark McBroom 2018년 2월 25일
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
Alex Bogias
Alex Bogias 2018년 2월 26일
편집: Alex Bogias 2018년 2월 26일
Thanks for taking the time to reply Mark.I really appreciate it.
I will give your (/blog) suggestion a try.

댓글을 달려면 로그인하십시오.

카테고리

Help CenterFile Exchange에서 Simulink Coder에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by