getkeywait

버전 3.0 (2.18 KB) 작성자: Jos (10584)
Wait a certain time for a single keypress
다운로드 수: 6.8K
업데이트 날짜: 2019/2/11

라이선스 보기

CH = getkeywait(P) waits for a keypress for a maximum of P seconds. P
should be a positive number. CH is a double representing the key
pressed key as an ascii number, including backspace (8), space (32),
enter (13), etc. If a non-ascii key (Ctrl, Alt, etc.) is pressed, CH
will be NaN. If no key is pressed within P seconds, -1 is returned,
and if something went wrong during excution 0 is returned.
Without argument, getkeywait waits until a key is pressed.

[CH, RT] = getkeywait(..) returns the response time in seconds in RT.


Example:
disp('Press a key within 5 seconds') ;
[CH, DT] = getkeywait(5)

See also input, ginput, waitbar, msgbox
getkey (file Exchange)

Authors note: This file was created in 2005 and is still working ;-)

인용 양식

Jos (10584) (2024). getkeywait (https://www.mathworks.com/matlabcentral/fileexchange/8297-getkeywait), MATLAB Central File Exchange. 검색됨 .

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

받음: getkey

줌: waitinput

Community Treasure Hunt

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

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

modernised

1.2.0.0

changed some figure properties; added check for figure existence

1.1.0.0

updated checks and output

1.0.0.0

The timer object existed beyond the scope of the function, which could be problematic when the function is called often, e.g., in a long loop.