timeout

버전 1.0.0.0 (1.09 KB) 작성자: Mikhail
Interrupt execution of script or function after specified period of time
다운로드 수: 617
업데이트 날짜: 2017/1/24

라이선스 보기

Interrupt execution of script, function or MATLAB expression after specified period of time. Similar to timeout from GNU coreutils.
This function uses undocumented command window method to programatically send Ctrl+C after specified period of time.

There are other ways of sending Ctrl+C programmatically, including Java Robot or SIGINT on Linux, but they require changes to the script or function that we want to interrupt.

This submission serves as a PoC and demonstration. Adapt to your specific needs if necessary.

Usage examples

Run the 'longComputations' script for no more than 5 seconds:
>> timeout('longComputations',5)

Interrupt execution of infinite pause after 3 seconds:
>> timeout('pause(inf)',3)

인용 양식

Mikhail (2024). timeout (https://www.mathworks.com/matlabcentral/fileexchange/61263-timeout), MATLAB Central File Exchange. 검색됨 .

MATLAB 릴리스 호환 정보
개발 환경: R2016b
모든 릴리스와 호환
플랫폼 호환성
Windows macOS Linux
카테고리
Help CenterMATLAB Answers에서 Call Python from MATLAB에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!
버전 게시됨 릴리스 정보
1.0.0.0