how to have indication of matlab function stopped
조회 수: 1 (최근 30일)
이전 댓글 표시
Hi,
is there a way to have an indication when matlab function stops?
lets say i have a function and i want to use another function in cases that the first one stopped/got stuck.
how can i do this?
thank you
댓글 수: 2
John D'Errico
2020년 7월 5일
What do you mean by stopped/got stuck?
Are you asking how to know when another function seems stuck in an infinite loop?
Are you asking to know when a function has terminated running due to some error condition?
답변 (1개)
dipak nigam
2020년 7월 5일
편집: dipak nigam
2020년 7월 5일
As per my understanding, you want to run another function if your present function raises an 'error' or 'fails'. You can put the statements prone to failure in a try block and call the other function in a catch block to achieve this functionality.
Here you can find the documentation for the same-
Otherwise, you can use the condition statements if your current function does not raise an error.
In the case your function just stops the execution and doesn't raises an error, i.e 'gets stuck' you can create a timer until the expected time-limit and then raise an exception/error yourself after that timer runs out. Try-catch statements can be used with timer to handle such cases.
You may get some idea here-
댓글 수: 0
참고 항목
카테고리
Help Center 및 File Exchange에서 Startup and Shutdown에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!