try/catch with timeout

18 views (last 30 days)
Lionel Pöffel
Lionel Pöffel on 18 Mar 2021
Commented: Rik on 18 Mar 2021
I have an instruction block with communication to external components, enclosed in try/catch. However, instead of throwing an exceptionand skipping to the "catch" part, the execution simply stalls under certain conditions. Is there any way top realize something like
try (max execution time x seconds)
instructions with possible stall
catch ME
will be executed either if instructions within try throw an exception or their execution takes more than x s
end
  1 Comment
Rik
Rik on 18 Mar 2021
As far as I'm aware, this is only possible by spawning a new process, which then needs to signal to the main process that it is done by writing a file or something similar.

Sign in to comment.

Answers (0)

Community Treasure Hunt

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

Start Hunting!