필터 지우기
필터 지우기

Turn a Simulink model into a mex file

조회 수: 39 (최근 30일)
Cedric Kotitschke
Cedric Kotitschke 2021년 11월 1일
답변: Salman Ahmed 2021년 11월 16일
Hey!
I'm trying to compare different algorithms and I have most of them in form of MATLAB functions. One of them, however, was given to me in form of a simulink model (don't ask why - I don't understand it either).
I thought what might be possible is to generate C code from the model and turn that into a mex file so that I can use it in Matlab. Calling the simulink model for several thousand times just takes too much time.
The model should have a pure input/output behaviour which means that there are no integrators (or something similar) inside it. In principle, it should be possible to turn this into a simple MATLAB function as it has no states.
I tried generating the code with the Simulink coder and then call
mex model.c
but I get the error:
"rt_logging.h": No such file or directory
Do you have any idea how to solve this problem?
Thanks so much!

답변 (1개)

Salman Ahmed
Salman Ahmed 2021년 11월 16일
Hi Cedric,
The rt_logging.h file is only used if you are logging data to a MAT-file. So it assumes the MAT-file logging option is checked. You can uncheck this option in the model properties of your Simulink model by navigating through Code Generation > Interface > Advanced parameters and uncheck MAT-file logging option.
From what I understand, you wish to convert your Simulink model to MATLAB code. There is no direct method of doing so. If you wish to proceed with mex file creation, you have to do some post processing on the generated C code to include an entry point mexFunction( ). Also, you may need to modify the generated code as it is derived from a deployment perspective.

카테고리

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

제품


릴리스

R2021a

Community Treasure Hunt

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

Start Hunting!

Translated by