Calculate Time from presenting a sound up to clicking a button in mouse. (Reaction Time)

2 Ansichten (letzte 30 Tage)
Hello everybody, I have a problem with this following issue:
I generate some sounds and participent for every sound push the right or left button in mouse. Right now I want to calculate time from when the sound is sent in ears to when the participant presses the right or left clicks.(Reaction time). line 16 from my code, I use a function from Psychtoolbox in Matlab.
Please if anyone have any ideas tell me about that.
(http://psychtoolbox.org/docs/GetClicks)
clc
clear;
SamplingRate=48000;
F=[250 500 1000 2000 4000];
t=linspace(0,1,SamplingRate);
ind=0;
memory{1,1}={0};
for i=1:length(F)
ind=1+ind;
Frequency = F(i);
y=sin(t*2*pi*Frequency);
%% This here I want to calculate time from a sound will present in ear up to a participent click left or right button in mouse
% It means, calculate Reaction time
sound(y,SamplingRate) ;
[clicks,~,~,whichButton] = GetClicks; %% This function is related to the Psychtoolbox in Matlab
%%
pause(5)
memory{1,ind} = y';
end

Antworten (0)

Community Treasure Hunt

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

Start Hunting!

Translated by