Matlab Coder for .m archives that call another .m archives

조회 수: 1 (최근 30일)
David López de la Cruz
David López de la Cruz 2019년 5월 10일
댓글: David López de la Cruz 2019년 5월 22일
I want to generate C code from a .m archive from MATLAB, but this archive calls different .m archives from its code, such as another script or a function. How can I generate portable and readable C code so that the complete .m archive could run correctly?
On the other hand, I would like to know which kind of code would run faster my .m archive. Do I use C code, a MEX function or an executable?

답변 (1개)

Pruthvi Muppavarapu
Pruthvi Muppavarapu 2019년 5월 14일
Hi David,
That should not be a problem. When you ask to process your top-level function, the coder will automatically find the routines that are called, and the routines that they call, and so on. So you should be able to successfully generate C code using the top-level .m archive.
To answer to your second query, MEX functions could be used for accelerated versions of your .m archives. You might use MEX functions for faster execution of your .m files.
Hope this helps.
Regards,
Pruthvi
  댓글 수: 1
David López de la Cruz
David López de la Cruz 2019년 5월 22일
Hello again Pruthvi,
I finally did a MEX functions of a .m one, and when execute the process I can't see the difference in terms of time. What I have changed in the code is calling the MEX function name instead of the .m function, but it hasn't fasten the execution at all, even when the function inside this MEX archive is the slowest of my process (An ode45 command).
What happened to this? Shouldn't this change accelerate the execution?
Regards,
David

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

카테고리

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

Community Treasure Hunt

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

Start Hunting!

Translated by