-
Notifications
You must be signed in to change notification settings - Fork 4
/
Timing.m
34 lines (31 loc) · 1.03 KB
/
Timing.m
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
31
32
33
34
classdef Timing < hgsetget & dynamicprops
% Store timing information for a Study. Handle object, so the same
% instance is updated throughout the experiment to track timings. This
% is a master object - use inherited SecondTiming / ScanTiming for
% instances.
properties
first = 0; % absolute time at beginning of runtrials
current = [];% best current estimate of time
previous = []; % former current
units = ''; % string describing what sort of timings we work with
end
methods
function t = Timing(varargin)
if nargin==0
return
end
sout = varargs2structfields(varargin,t);
for fn = fieldnames(sout)'
t.(fn{1}) = sout.(fn{1});
end
end
function update(self,newtime)
[self.previous,self.current] = deal(self.current,newtime);
end
end
methods (Abstract)
t = begin(self);
t = check(self);
waituntil(self,abstime)
end
end