Forcing MATLAB script timeout without modification
Mostrar comentarios más antiguos
I am running many scripts to analyze time, memory, etc., the problem is some hang for a long time (2-3 minutes) and in that case, I just want to "skip" them and not let them finish. The problem is I can not figure out how to force a timeout on the scripts. I thought by adding in a timer in a try/catch block that throws an error after 30 seconds, it could be a workaround, but it turns out the timer will display an error on the console, but does nothing at all to signal to the try catch block that an error occured.
I had two other ideas, but I am not sure exactly how they would work. 1) Calling a batch file that ran the script, but could also kill it after 30 seconds, my one big concern would be getting all the test results back into the over-arching program running the tests, but I think that can still be done relatively easily. 2) This one is a little more crazy and almost positive it would not work the way I am thinking about it, but somehow modifying or deleting the script it was running after 30 seconds and then replacing it with a copy if it did delete or modify it to stop.
Any ideas or suggestions?
Thanks!
Respuesta aceptada
Más respuestas (0)
Categorías
Más información sobre Get Started with MATLAB en Centro de ayuda y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!