-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathagraph.m
86 lines (69 loc) · 2.5 KB
/
agraph.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
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
% Plot the percentage of anticipation saccades for each subject for each
% ISI
%
% Input - E: The structure of all subjects generated by readAll
function agraph(E, groups, gnames)
LTHRESHOLD=-500;
HTHRESHOLD=500;
nsub=length(E.names);
nisis=length(E.isis);
for i=1:length(groups)
for j=1:length(groups{i})
names=char(E.names');
gsubs{i}(j)=strmatch(groups{i}(j), names);
end
end
hold on;
handles=[];
cols=colormap(lines(length(groups)));
tempbsrts={};
for i=1:nisis
for k=1:length(groups)
subs=gsubs{k};
for j=1:length(subs)
tsrts=E.bsrts{subs(j), i};
if size(tsrts, 1) > 0
[r c v]=find(tsrts<LTHRESHOLD|tsrts>HTHRESHOLD);
tsrts(r,:)=[];
if ~isempty(tsrts)
tempbsrts{i, k}(j)=(nnz(tsrts<=100)/numel(tsrts))*100;
end
end
end
if size(tempbsrts{i, k}) > 0
% Standard error
stderr=std(tempbsrts{i, k})/sqrt(length(tempbsrts{i, k}));
errorbar(i, nanmean(tempbsrts{i, k}), stderr, 'x', 'Color', cols(k,:));
tempbsrts{i, k}=nanmean(tempbsrts{i, k});
end
end
end
tempisrts=[];
for k=1:length(groups)
subs=gsubs{k};
for j=1:length(subs)
tsrts=E.isrts{subs(j)};
if size(tsrts, 1) > 0
[r c v]=find(tsrts<LTHRESHOLD|tsrts>HTHRESHOLD);
tsrts(r,:)=[];
if ~isempty(tsrts)
tempisrts{k}(j)=(nnz(tsrts<=100)/numel(tsrts))*100;
end
end
end
if size(tempisrts{k}) > 0
% Standard error
stderr=std(tempisrts{k})/sqrt(length(tempisrts{k}));
errorbar(i+1, nanmean(tempisrts{k}), stderr, 'x', 'Color', cols(k,:));
tempbsrts{i+1, k}=nanmean(tempisrts{k});
end
end
for k=1:length(groups)
handles(k)=plot(cell2mat(tempbsrts(:,k)), 'Color', cols(k,:));
end
legend(handles, gnames);
set(gca, 'XTick', [1:nisis+1], 'XTicklabel', [cellstr(num2str(E.isis')); 'Random']);
set(gcf, 'Color', 'white');
title('% of saccades < 100ms');
ylabel('Percent of Total Saccades');
xlabel('ISI (ms)');