Automate the response to command prompt in matlab

12 ビュー (過去 30 日間)
Sukshith Shetty
Sukshith Shetty 2021 年 4 月 28 日
回答済み: Fangjun Jiang 2021 年 4 月 28 日
Hi,
I am using system command([status,cmdout] = system(command,'-echo')) in matlab to access my linux kernel command prompt to execute a command. After the execution of the command in matlab, the matlab command prompt ask me to enter the system password which is the user password. In this case I need to manually type the password in the matlab command prompt to take the code execution further. During this time the whole matlab code execution pauses till I finish typing my password on the command prompt and press enter.
I would just like to know, is there a way where I can keep the password text in matlab window and after the command executes, the password text gets automatically typed in the matlab command prompt from the matlab window. I just want the code execution flow to be continuous on one click of the run button. I do not want to manually enter the password on the command prompt.
Thank you

回答 (1 件)

Fangjun Jiang
Fangjun Jiang 2021 年 4 月 28 日
There is a more secure way to do this such as using PuTTY PLINK.But if you don't mind storing and exposing your password, you could type in and save your password in a .txt file and run
system('MyCommand < Password.txt')

カテゴリ

Help Center および File ExchangeEntering Commands についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by