Calling executable and automatically passing input
7 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
Alex Dworzanczyk
el 10 de Abr. de 2020
Comentada: Alex Dworzanczyk
el 10 de Abr. de 2020
I am using MATLAB to automatically generate a thousand or so slightly different input files for an executable. The executable, when launched, asks for an input file name (in this case, 'test3') and returns an output (in this case, named 'test3.out'). I am using system('FCEA2.exe') to call the relevant executable, and this is where I get stuck--I get the executable appearing in my MATLAB command line asking for the input file name. I can get the script back on track by typing it into the command line, but I want the script to do it automatically so that I can get a thousand answers quickly.
Is there a way to call the FCEA2.exe executable and have MATLAB enter the input file name automatically, without pausing script execution?
0 comentarios
Respuesta aceptada
Ameer Hamza
el 10 de Abr. de 2020
Yes, you should be able to do this using input redirections and pipes. I am using a mac, so I can use an example from bash, but a similar method will apply for MS Windows. Suppose you have an executable file named myExecutable that takes input from the user. You can directly pass it inputs from the command line using the echo command and pipe
system('echo myInput | myExecutable')
echo command also exists in MS Windows, so hopefully, you will be able to run this line for your *.exe file directly.
Más respuestas (0)
Ver también
Categorías
Más información sobre Entering Commands en Help Center y File Exchange.
Productos
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!