Using SYSTEM to run an executable outside of Matlab

2 views (last 30 days)
Hello,
I would like to run a program outside of Matlab, and I have been able to start the program using
system('MYPROGRAM.EXE')
However, when the program has completed running, it prints a success message to the Command Window: "Run completed successfully. Press Return to continue."
I would like to automate this process so that I don't have to manually hit Enter every time the program is called. I am aware of the & option to make the Matlab code continue running; however, MYPROGRAM requires the Return in order to print the output (to text file) that I need.
Any help would be appreciated. (I am using Windows, if that matters.)
Thank you!

Accepted Answer

Fangjun Jiang
Fangjun Jiang on 30 Oct 2011
try system('MYPROGRAM.EXE < MyInput.txt') where MyInpu.txt is a text file you created ahead of time. The text file contains nothing but a return.
  3 Comments
John
John on 24 Aug 2015
Edited: John on 24 Aug 2015
Many thanks from me too! Had just the same problem (apparently some years later) and took me forever to find this simple yet clever solution of yours!
Tyler Murray
Tyler Murray on 29 Sep 2016
Can you send a program through MYPROGRAM.EXE and then do < MyInput.txt?

Sign in to comment.

More Answers (0)

Categories

Find more on MATLAB in Help Center and File Exchange

Tags

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!