Code conversion using matlab coder

조회 수: 3 (최근 30일)
Pushpa Shankar
Pushpa Shankar 2021년 9월 9일
댓글: Pushpa Shankar 2021년 9월 9일
Please help if anyone has gone through this.
1) I need to convert a matlab code which makes calls to 6 functions. The functions are written in separate scripts. The main file does the function call to these routines. The code is perfrctly working in Matlab. I donot know how to convert this main file from Matlab to C using Matlab coder. My doubt here is, should I convert each routine separately and then write a main C routine on my own to call these functions ? Or is there a method to directly convert the matlab file which calls these functions? I have to define a structure in the main code as well, and entering all the elements of struct externally everytime is becoming tedious. When I try to convert the main file of matlab directly it says enter a code that exercises the script, I really didnot get what it is. I also would like to know how to write a test script. Is there any specific rules or guidelines fror this ?

채택된 답변

Sean de Wolski
Sean de Wolski 2021년 9월 9일
Being pedantic, you should NOT be using scripts but functions for everything. So step 1 is convert everything to functions.
Re:
Or is there a method to directly convert the matlab file which calls these functions
You can do this, simply pick it as the entry point function in MATLAB Coder app and the dependencies will come along (you can choose to keep them separate or inline in settings). If you want the other functions to be valid entry points then you could add them too, but that does not seem to be the case.
  댓글 수: 1
Pushpa Shankar
Pushpa Shankar 2021년 9월 9일
Thank you very much. I will try that out.

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

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Code Generation and Deployment에 대해 자세히 알아보기

제품


릴리스

R2020b

Community Treasure Hunt

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

Start Hunting!

Translated by