Running external program in matlab and getting output results

こ雲淡風輕ζ 提交于 2019-12-11 19:49:32

问题


I need to write a script that will run external program from matlab and to get output results from it. This program should simulate 20 variants. I made those 20 files in matlab, and I'm able to open external program, but I am not able to write a command that will simulate the files in it. And return me output results. (Input files have .idf extension and output .eso)

I tried with these and similar commands

for id=1:20;
    system(sprintf('C:\...\myprogram.exe<''variant_%i.idf',id));
    i=1+1;
end

or

for id=1:20;
     cmd_line = '"C:\...\myprogram.exe" -f variant_%i.idf -o variant_%i.eso';
     [status, result] = system(cmd_line);
     i=1+1;
 end

I need to do this for exam, and I had only 3 weeks of matlab and never studied programming, so I'm sorry if this is a stupid question, but I don't know where else to ask.


回答1:


You may change your "myprogram.exe" in order to report the output data into a file.



来源:https://stackoverflow.com/questions/24046758/running-external-program-in-matlab-and-getting-output-results

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!