Using MATLAB Script To Run remote Linux Program via Telnet
2 ビュー (過去 30 日間)
古いコメントを表示
I have a C program on Linux Fedora 14, and now I am trying to remotely running it from a different PC using MATLAB via telnet. But right now all I can do is calling putty from matlab to access Linux terminal, and run the program through this remote terminal. But it is useless for me because I can't automate the MATLAB script to call the program repeatedly.
To illustrate my situation. Say I have a program Hello as following:
void main (int argc, char* argv){
if(argc > 0){
printf("Hello %s \n", argv);
printf("result is %d", argc++);
}
return;
}
I want to have a MATLAB script that can run this program from a remote PC and input a name and read the result multiple times. But now all I have is calling
system('C:\Putty\putty.exe <ip_address> -username -password')
from matlab and get the remote terminal on Linux, then manually run
./hello name.
How can I run the whole program from matlab directly through telnet? And get the result?
Thanks.
0 件のコメント
採用された回答
Jason Ross
2013 年 2 月 14 日
編集済み: Jason Ross
2013 年 2 月 14 日
You might want to try uing "plink" rather than PuTTY. It's part of the PuTTY suite, so you likely have it already since you've installed PuTTY.
Section 7.3 is pretty close to what you are trying to do.
As for getting the result, the program can output to the terminal and you can use
[status,result] = system(<system command here>)
to get it. Or, if you have a common filesystem between the two systems, you could output it there and then retrieve it.
5 件のコメント
Jason Ross
2013 年 2 月 15 日
Well, if there is a specific error condition for it, I'd guess so. :)
I haven't used telnet in a while -- does it challenge you for a password? In general, I'd say ssh is probably the more portable and maintainable choice, anyway -- telnet and rsh are still useful tools, but the world has largely moved to ssh for any number of reasons (secure, traceable, configurable, standard, debuggable, etc)
その他の回答 (1 件)
Walter Roberson
2013 年 2 月 14 日
You are probably using the wrong program for your needs. See
0 件のコメント
参考
カテゴリ
Help Center および File Exchange で Calendar についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!