Code conversion using matlab coder

3 visualizaciones (últimos 30 días)
Pushpa Shankar
Pushpa Shankar el 9 de Sept. de 2021
Comentada: Pushpa Shankar el 9 de Sept. de 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 ?

Respuesta aceptada

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

Iniciar sesión para comentar.

Más respuestas (0)

Categorías

Más información sobre Code Generation and Deployment en Help Center y File Exchange.

Productos


Versión

R2020b

Community Treasure Hunt

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

Start Hunting!

Translated by