Code conversion using matlab coder
3 次查看(过去 30 天)
显示 更早的评论
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 ?
0 个评论
采纳的回答
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.
更多回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Code Generation and Deployment 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!