Running external program as batch file with delayed inputs
3 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
Jan Knop
am 22 Jun. 2023
Kommentiert: Jan Knop
am 23 Jun. 2023
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 Kommentare
Rik
am 23 Jun. 2023
What do you mean with " the inputs are too fast for the batch program"?
And what exactly do you want to delay?
Akzeptierte Antwort
Harald
am 23 Jun. 2023
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 Kommentare
Harald
am 23 Jun. 2023
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
Weitere Antworten (0)
Siehe auch
Kategorien
Mehr zu Entering Commands finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!