Detecting a hung command
3 views (last 30 days)
Show older comments
Hi All, I have a for loop in which I run a non-Matlab command... specifically, "findscu" which is part of the dicom toolkit:
for i=1:n
unix(['findscu ...'])
end
Unfortunately, this command hangs once in a while, sometimes a day later and sometimes a few hours. I have to constantly check to see if I need to ctrl-C and restart my code. Importantly, Matlab does not crash, rather, the findscu code just gets stuck searching indefinitely and does not progress to the next iteration of the loop. Can anyone think of a way in which I might be able to have a timeout such that I can force my code to error out after a certain time so that I can automatically go to the next iteration of the loop? thanks!
0 Comments
Answers (1)
Walter Roberson
on 11 May 2016
If it is using CPU time then you could also use "ulimit -t"
0 Comments
See Also
Categories
Find more on Loops and Conditional Statements in Help Center and File Exchange
Products
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!