How to time out a Matlab command?

조회 수: 3 (최근 30일)
K E
K E 2016년 7월 7일
댓글: jgg 2016년 7월 7일
Is there a way to time out a Matlab command within a mfile, so that mfile execution resumes after a certain time spent on the Matlab command?
Background: Each day I automatically run a mfile which includes ftp of remote files. My company's FTP server sometimes has problems: the ftp command will connect but hang indefinitely yet no errors are returned, so I can't use try/catch. If our office manager restarts the FTP server manually (I don't have access) it fixes the ftp problem, but until then I want the mfile to complete since it does other useful things besides FTP. Ideally the mfile would kill the ftp command if more than 5 minutes have elapsed, then run the rest of the mfile.
Any ideas how to do this? I want the mfile to work on different machines so prefer to avoid solutions based on installing new software, like new FTP clients.
  댓글 수: 1
jgg
jgg 2016년 7월 7일
I think, in general, this is probably not possible or easy, since you'd need multiple processing threads to track another running process, which sounds nasty.
However, it might be possible if there's some detail on how exactly are you are calling the command. For example, if it's infinitely looping a call or something, you could set up a persistent timer and then throw an error when the timer expires.
But this depends on your specific situation; there's no general way to do this.

댓글을 달려면 로그인하십시오.

답변 (0개)

카테고리

Help CenterFile Exchange에서 Downloads에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by