How can I call a .com function through MatLab
3 次查看(过去 30 天)
显示 更早的评论
I have a .COM file that can be run through the windows cmd prompt. This file takes 3 user inputs to run. I'd like to be able to run this function in a batch with per-determined inputs.
I've tried using the system and dos functions as follows:
system('myfile.com arg1 arg2 arg3')
system('"myfile.com" arg1 arg2 arg3')
dos('myfile.com arg1 arg2 arg3')
dos('"myfile.com" arg1 arg2 arg3')
These seem to put matlab in an endless loop. I know that the .com program take a short time to run, but when I attempt to call it in this way matlab just runs and I need to use 'ctrl + Break' to stop. Any advice would be appreciated.
2 个评论
Walter Roberson
2012-11-13
Does it take the user inputs on the command line, or does it prompt for them?
采纳的回答
Walter Roberson
2012-11-13
In MATLAB, create a file that contains the three input files, one per line. Then,
system(['myfile.com <' TheFileName])
11 个评论
Walter Roberson
2012-11-14
That approach is not going to work. Unfortunately I do not have time at the moment to explore.
更多回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Startup and Shutdown 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!