-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathbehaviorMonitor.m
46 lines (36 loc) · 1.05 KB
/
behaviorMonitor.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
35
36
37
38
39
40
41
42
43
44
45
46
function out = behaviorMonitor(animalName, dateString)
addpath('\\zserver.cortexlab.net\Code\Psychofit');
if nargin<1
error('You must provide the animal name');
end
if nargin<2
% by default will use latest available dataset
dateString = [];
end
% for debugging purposes
% animalName = 'MK012';
% dateString = '2014-07-14';
[expRefs, expDates, expSessions] = dat.listExps(animalName);
if isempty(dateString)
% using the latest experiment date
idx = find(expDates == max(expDates));
else
% or picking a specific date
idx = find(expDates == datenum(dateString));
end
% picking the latest session of that day
[~, ind] = max(expSessions(idx));
idx = idx(ind);
ExpRef = upper(expRefs{idx});
% fprintf('\nAnimal %s, found %d session(s) for %s\n\n', animalName, nSessions, dateString);
figureHandle = figure('Name', sprintf('%s %s', animalName, dateString));
while true
try
behaviorSnapshot(figureHandle, ExpRef);
catch e
warning(e.message)
end
pause(10);
end
end
%================================================