Using MATLAB Script To Run remote Linux Program via Telnet
6 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
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 comentarios
Respuesta aceptada
Jason Ross
el 14 de Feb. de 2013
Editada: Jason Ross
el 14 de Feb. de 2013
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 comentarios
Jason Ross
el 15 de Feb. de 2013
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)
Más respuestas (1)
Walter Roberson
el 14 de Feb. de 2013
You are probably using the wrong program for your needs. See
0 comentarios
Ver también
Categorías
Más información sobre Calendar en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!