-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathNYU_ntools_elec_autoplot.m
41 lines (32 loc) · 1.33 KB
/
NYU_ntools_elec_autoplot.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
function NYU_ntools_elec_autoplot(fname,surfmat,aparc)
% automatically save elec images with/without labels/aparc in background
% only plot one hemisphere at a time.
if exist(fname,'file')
fid = fopen(fname);
elec_all = textscan(fid,'%s %f %f %f %s');
% elec_cell = [elec_all{1},num2cell(elec_all{2}),num2cell(elec_all{3}),num2cell(elec_all{4})];
label = elec_all{5};
else
disp('No electrode was found. Please check you input text file.')
return
end
unique_label = unique(label);
if ismember('G',unique_label) && ismember('S',unique_label)
plt = 'GS';
elseif ismember('G',unique_label) && ~ismember('S',unique_label)
plt = 'G';
elseif ~ismember('G',unique_label) && ismember('S',unique_label)
plt = 'S';
else
plt = [];
end
if ~isempty(plt)
ntools_elec_plot(fname,surfmat,'plot',plt,'saveimg',10,'showlabel',1,'aparc',[]);
ntools_elec_plot(fname,surfmat,'plot',plt,'saveimg',10,'showlabel',0,'aparc',[]);
ntools_elec_plot(fname,surfmat,'plot',plt,'saveimg',10,'showlabel',0,'aparc',aparc);
ntools_elec_plot(fname,surfmat,'plot',plt,'saveimg',10,'showlabel',1,'aparc',aparc);
end
if ismember('D',unique_label)
ntools_elec_plot(fname,surfmat,'plot','D','saveimg',10,'showlabel',1,'aparc',[]);
ntools_elec_plot(fname,surfmat,'plot','D','saveimg',10,'showlabel',0,'aparc',[]);
end