-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathlickArrayMaker.m
More file actions
17 lines (16 loc) · 959 Bytes
/
lickArrayMaker.m
File metadata and controls
17 lines (16 loc) · 959 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
%% Creates array showing whether or not the mouse in question licked during a trial
% Created by J. Sy on 2014-12-4
% Use on array with mouse data
function [lickArray, trialCount] = lickArrayMaker(x)
trialCount = numel(x.AnalysisSection_FAR); % Helpfully includes the overall number of trials for your convenience
lickArray = zeros(trialCount,1);
for i = 1:trialCount
if x.AnalysisSection_NumTrials{i} == 1 % Discounts the first trial since it's autoscored as a hit and difficult to code in accurately
lickArray(i) = 0;
elseif x.AnalysisSection_HR{i} > x.AnalysisSection_HR{i-1} % Compares hit ratio at end of current trial to the end of the previous trial. An increase implies a lick
lickArray(i) = 1;
elseif x.AnalysisSection_FAR{i} > x.AnalysisSection_FAR{i-1} % Same as above, an increase still implies a lick
lickArray(i) = 1;
else lickArray(i) = 0; % No increase in HR or FAR implies no lick
end
end