How to run a .exe program from matlab and pass console input as an argument?
Show older comments
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 &');
Accepted Answer
More Answers (1)
Jonathan Chase
on 6 Oct 2023
Moved: Walter Roberson
on 7 Oct 2023
Categories
Find more on Startup and Shutdown in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!