controling PuTTy through Matlab

11 ビュー (過去 30 日間)
Daniel
Daniel 2011 年 11 月 4 日
My task is this: I need to open PuTTy on a Windows machine, connect to a Linux box, start a program (FreeSurfer) on that box and run some commands. I tried using the FileExchange's "SSH From Matlab (updated) + SFTP/SCP", but I could not run the FreeSurfer commands once I started it, so I figured I could use tcpip to communicate with PuTTy on the Local machine; however, I don't know how to connect to PuTTy using Matlab on the Windows machine. I believe this is a case for using the tcpip commands, but I'm lost. I think the first step might be:
t = tcpip('localhost',<port for talking with PuTTy>);
but I have no idea what port I should choose.
Any help would be appreciated.

回答 (1 件)

Jason Ross
Jason Ross 2011 年 11 月 4 日
Rather than using PuTTY, you might want to try using plink, which is part of the PuTTY suite and is much more geared to CLI operation:
Overall, though, your question is a little confusing. As I understand it, PuTTY is a client program that allows connection via various protocols (SSH, rsh, Serial, Telnet, etc) but your must be running something to connect to. I'm guessing that may be the FreeSurfer program? Or are you using rsh or ssh as the protocol?
Also, if possible I would recommend keeping this communication as simple as possible. If you could script the startup of the remote program in some manner and only send over one command, that would be much better than trying to interact. It doesn't need to be anything grandiose, either -- likely a shell script that would take input arguments and then pass them on to the startup command, and return an appropriate exit status would likely be enough.
  3 件のコメント
Jason Ross
Jason Ross 2011 年 11 月 4 日
Yep. Makes sense.
In the spirit of "alternate design", have you considered doing this through http? It would handle a lot of the connection setup, teardown, concurrency, etc for you.
Jason Ross
Jason Ross 2011 年 11 月 4 日
Of course, that adds in the additional complexity of the webserver and setting up some form of interface that will query the freesurfer program, then return said data in some format. Which could also run into problems depending on the size of the data set returned.
One door closes, two open, I guess :)

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

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by