フィルターのクリア

How to answer a call for an input from the script?

3 ビュー (過去 30 日間)
Ali Almakhmari
Ali Almakhmari 2022 年 12 月 15 日
編集済み: Fangjun Jiang 2022 年 12 月 15 日
So I used the system('run.bat') in my script to run a series of commands that will ask certain questions. I want to code the answers to those questions in my script such that I dont have to manually answer them in MATLAB's command window. Is there a way to do this?
  2 件のコメント
chrisw23
chrisw23 2022 年 12 月 15 日
編集済み: chrisw23 2022 年 12 月 15 日
per definition of the system cmd there will be no return value until the execution was finished
status = system(command) calls the operating system to execute the specified command. The operation waits for the command to finish execution before returning the exit status of the command to the status variable.
so I think the system cmd is not the way to solve your problem
Ali Almakhmari
Ali Almakhmari 2022 年 12 月 15 日
Thats what I guessed as well. I tried researching few possibilities but failed in all directions. If you have any tips or somewhere to look further let me know.

サインインしてコメントする。

採用された回答

Fangjun Jiang
Fangjun Jiang 2022 年 12 月 15 日
編集済み: Fangjun Jiang 2022 年 12 月 15 日
I know if you run system('MyApp.exe') and MyApp.exe asks for your input and you key in three letters 'abc',
then you can create a text file, e.g. input.txt which contains the text 'abc' without the single quotes,
then you can run system('MyApp.exe < input.txt') which will not require you to type in anymore.
This method have helped many in this forum.
Try this with your 'run.bat'. I am not sure if run.bat calls many App.exe, whether you can combine all the inputs into one text file.
  1 件のコメント
Ali Almakhmari
Ali Almakhmari 2022 年 12 月 15 日
編集済み: Ali Almakhmari 2022 年 12 月 15 日
Thank you so much.

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeControl System Toolbox についてさらに検索

タグ

製品


リリース

R2022a

Community Treasure Hunt

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

Start Hunting!

Translated by