forked from jooh/matlab-studytools
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathResponseCheck.m
More file actions
30 lines (27 loc) · 796 Bytes
/
Copy pathResponseCheck.m
File metadata and controls
30 lines (27 loc) · 796 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
classdef ResponseCheck < StudyEvent
% StudyEvent subclass for logging responses
properties
validkeys = []; % vector of possible responses
name = 'responsecheck';
keyisdown = 0;
lastkey = NaN;
end
methods
function s = ResponseCheck(varargin)
if nargin==0
return
end
s = varargs2structfields(varargin,s);
end
function call(self)
self.ncalls = self.ncalls + 1;
[respk,resptime] = self.checkkeys;
[validresp,x,inds] = intersect(self.validkeys,respk);
self.response = validresp;
self.responsetime = resptime(inds);
end
end
methods (Abstract)
[respk,resptime] = checkkeys(self);
end
end