Running external program as batch file with delayed inputs
3 次查看(过去 30 天)
显示 更早的评论
I have created a batch file "myBatchFile.bat" of my external program and have my inputs in a seperate input file "inputs.txt" with a buch of inputs, which have to be input after another. The inputs look as follows:
input1
input2
input3
...
inputn
I'm calling the program and inputs with:
commandfileName = 'inputs.txt';
runfileName = 'myBatchFile.bat'
[~,~] = system([runfileName blanks(1) commandfileName], '-echo');
I run into the issue, that the inputs are too fast for the batch program. To avoid this issue I'd like to have a delay inbetween each input. I can't figure out how to implement that delay.
2 个评论
Rik
2023-6-23
What do you mean with " the inputs are too fast for the batch program"?
And what exactly do you want to delay?
采纳的回答
Harald
2023-6-23
Hi Jan,
I would primarily consider that an issue of the .bat-file: if it is designed to accept multiple commands via a text file, it should automatically build in those delays as needed.
If you can't modify the .bat file yourself or get its author to do so, the only alternative I see is to split the system calls and inputs.txt into multiple calls and files and insert according statements, e.g., pause or timers, in MATLAB.
Best wishes,
Harald
2 个评论
Harald
2023-6-23
Hi Jan,
in that case, it might be easiest to split the .bat file into several ones and take care of the delaying in MATLAB using pause or timers.
Alternatively, this link gives some ways of delaying the execution of a .bat file:
I hope this helps. :) If it does, please kindly accept the answer.
Best wishes,
Harald
更多回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Entering Commands 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!