Code conversion using matlab coder

22 vues (au cours des 30 derniers jours)
Pushpa Shankar
Pushpa Shankar le 9 Sep 2021
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 ?

Réponse acceptée

Sean de Wolski
Sean de Wolski le 9 Sep 2021
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 commentaire
Pushpa Shankar
Pushpa Shankar le 9 Sep 2021
Thank you very much. I will try that out.

Connectez-vous pour commenter.

Plus de réponses (0)

Catégories

En savoir plus sur MATLAB Coder dans Help Center et File Exchange

Produits


Version

R2020b

Community Treasure Hunt

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

Start Hunting!

Translated by