How determine if a key is pressed

조회 수: 73 (최근 30일)
Arabarra
Arabarra 2020년 3월 12일
편집: Walter Roberson 2020년 11월 16일
Hi,
is there a system-portable way to determine if a given key is pressed?
I found this:
but it only works for windows....
cheers,
Daniel

답변 (1개)

Walter Roberson
Walter Roberson 2020년 3월 12일
편집: Walter Roberson 2020년 11월 16일
Depends what you mean and what you are willing to live with.
For regular keys and you are willing to have a figure covering the display then WindowKeyPressFcn callback and test the event structure.
If you need the check to work without a figure then see:
There might also be Java approaches.
The psychtoolbox functions are more complete and robust and better suited for timing.

카테고리

Help CenterFile Exchange에서 Timing and presenting 2D and 3D stimuli에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by