- https://www.mathworks.com/matlabcentral/answers/362688-calculate-and-print-the-duration-of-keypress
- https://www.mathworks.com/matlabcentral/answers/318995-how-to-get-the-duration-of-a-pressed-key-in-matlab
How can I get the duration time of a key press with Psychtoolbox?
3 views (last 30 days)
Show older comments
I am designing an experiment where subjects have to respond continously at two stimuli which will be presented alternately. They will be respond with two key presses: e.g. "a" for stimulus 1 and "b" for stimulus 2.
I need to know which key is pressed and for how long each key is hold down during each trial.
For the former I can use KbCheck but I don't know how to obtain the latter information.
Can anyone help me, please?
Best.
0 Comments
Answers (1)
Arjun
on 3 Mar 2025
I see that you want to get the time duration for which a key was pressed.
You can refer to the following MATLAB Answers inorder to explore some ways in which it can be done:
I hope this helps!
0 Comments
See Also
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!