Stop the execution with a certain number of second
조회 수: 17 (최근 30일)
이전 댓글 표시
I want to stop the execution with a certain number of seconds. In toher words, the script is running, but when the length is greater than 100 seconds, I want to stop the execution.
How I must do it?
댓글 수: 0
답변 (2개)
KSSV
2019년 3월 22일
t1 = tic ;
while t1
t2 = toc(t1) ;
if t2 > 10
fprintf('loop breaked because 10 seconds passed\n')
break
end
end
댓글 수: 2
KSSV
2019년 3월 22일
J.J commented: But I want to leave the script, not to stop during 10 seconds. So, I want that the script runs but when the legnth is x seconds, I want leave it.
참고 항목
카테고리
Help Center 및 File Exchange에서 Logical에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!