Automatically entering information to external program run from system() command
2 ビュー (過去 30 日間)
古いコメントを表示
I'm working on an m-file that will call an external program using the system() command. Once the system() command is called, an external program (written in C) initializes. In the MATLAB command window, the external program appears and asks for input. I want to automate the process of entering the input by adding commands to the m-file, but cannot figure out how to do this. Successive calls to system() have no effect, as the command window just sits there waiting for me to manually enter input.
Does anyone have any ideas? Thanks in advance.
0 件のコメント
採用された回答
Walter Roberson
2011 年 7 月 27 日
Java Robot Class if you want to be sure of it.
Depending on how the input is read, using I/O redirection might work,
system('theCommand < InputFile')
0 件のコメント
その他の回答 (1 件)
Jason Ross
2011 年 7 月 27 日
If you have access to the C source code, it might be worth your time to build a better way of getting the data in, such as a command line switch or the ability to parse an input file. This way, the m-code just builds up the command you want to send to the system command and you bypass the whole messy input stage.
0 件のコメント
参考
カテゴリ
Help Center および File Exchange で Environment and Settings についてさらに検索
製品
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!