How to run a .exe program from matlab and pass console input as an argument?
Afficher commentaires plus anciens
Hello,
I'm trying to run a precompiled c++ program within a matlab project using the 'system()' function. Calling the c++ program is striaghtforward and works fine (see below).
system('Fourier.exe &');
The issue I'm having is within the c++ program itself, which uses the 'getch()' function and requires user input from the keyboard to continue at a certain point within the program. Altering the source code and recompiling the program is out of the scope of the project work. I am just trying to automate this script so it will call the program and continue automatically, without needing console input from the user. This would allow the program to run in the background without monitoring it.
Is there a way to pass a user input from the keyboard as an argument to the 'system()' function, so that way when the c++ program reaches the line where it requires user input, it will just continue?
I have also tried including '< nul' (below) but that doesnt work either. Any help would be greatly appreciated.
system('Fourier.exe < nul &');
Réponse acceptée
Plus de réponses (1)
Jonathan Chase
le 6 Oct 2023
Déplacé(e) : Walter Roberson
le 7 Oct 2023
Catégories
En savoir plus sur Startup and Shutdown dans Centre d'aide et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!