在Matlab中运行外部程序并获取输出结果 [英] Running external program in matlab and getting output results
问题描述
我需要编写一个脚本,该脚本将从matlab运行外部程序并从中获取输出结果.该程序应模拟20个变体.我在matlab中制作了这20个文件,并且可以打开外部程序,但无法编写命令来模拟其中的文件.并返回我的输出结果. (输入文件的扩展名为.idf,输出的文件为.eso)
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
或
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
我需要做这个考试,而且我只有3个星期的matlab并且从未学习过编程,因此,很抱歉这是一个愚蠢的问题,但我不知道还有什么要问的.
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.
推荐答案
您可以更改"myprogram.exe",以便将输出数据报告到文件中.
You may change your "myprogram.exe" in order to report the output data into a file.
这篇关于在Matlab中运行外部程序并获取输出结果的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!