Use of Simulink-generated MEX function within MATLAB

조회 수: 1 (최근 30일)
Ioannis Sarris
Ioannis Sarris 2015년 4월 16일
댓글: Simon Meyer 2020년 9월 28일
Assume that you have a MATLAB function that generates a waveform (vector A) and a Simulink model that represents a combination of filters.
Is there any way, by which, the Simulink model can be invoked through MATLAB as a MEX function (eg B = sim_func_mex(A)) in order to pass the waveform through the filters and obtain the output (vector B) WITHOUT opening Simulink (ie without issuing a sim() command) and without requiring a Simulink license?
This scenario is very common, where a number of people need to work on a MATLAB function but DO NOT need access (i.e. they do not need to view/modify) the Simulink model.
Any help would be very much appreciated.
Regards, Ioannis

답변 (2개)

Titus Edelhofer
Titus Edelhofer 2015년 4월 16일
Hi Ioannis,
if you have Simulink Coder available, you can convert your Simulink model to C Code (and create either an executable or a dll). This you (other users) can call then from MATLAB without the need of Simulink. What you need though is the license for Simulink Coder ...
Titus

Ioannis Sarris
Ioannis Sarris 2015년 4월 16일
Thanks Titus for your answer. I have thought of this possibility but I would expect that a simpler solution should be possible, since this requires building a MEX wrapper for the C-code and compiling it. At the end of the day, Simulink creates a MEX file of your model in Accelerated mode, so why is it not possible to reuse that?
Thanks again.
  댓글 수: 1
Simon Meyer
Simon Meyer 2020년 9월 28일
Hello Ioannis,
currently I am struggeling with the same problem. I know this post is pretty old, but did you find any good way to solve this issue, or can you give any advice for me?
Thank you very much!
Simon

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

카테고리

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