Is there a way to generate c code for system function which runs batch file?

1 次查看(过去 30 天)
I am trying to run a batch file which eventually runs an exe file. I am trying to use system function to run this batch file.But system is not supported for code generation. Is there a way to generate c code for system function or is there a way with which I can run a batch file which will be supported by code generation?

回答(1 个)

Walter Roberson
Walter Roberson 2018-1-9
In Unix systems, execv() or execvp() would often be used.
  7 个评论
Walter Roberson
Walter Roberson 2018-1-10
The non-deploy branch,
y = 'C:\Users\Tester\Desktop\Release\meter_app.bat';
should also
system(y)
You should pay attention to the data type of the return value: system() at the C level returns an int, but in the non-deploy branch you have it returning a character vector. Perhaps you should change the deploy branch to
y = system('C:\Users\Tester\Desktop\Release\meter_app.bat');
I recommend changing your declaration from
int execute();
to
int execute(void);
sai kamal sreeja veepuri
What care do I have to take in terms of path? I mean the code which is generated by means of codegen -config:lib callexecute execute.c execute.h is in different path and the files that are generated for rest of the simulink model is in different path.Do I have to place both of them in the same place?

请先登录,再进行评论。

类别

Help CenterFile Exchange 中查找有关 Generating Code 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by