-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmakeEcogField.m
More file actions
48 lines (45 loc) · 1.65 KB
/
makeEcogField.m
File metadata and controls
48 lines (45 loc) · 1.65 KB
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
% This is to make an field named 'Ecog' in the preprocessed data folder for
% those subjects who don't currently have them.
% PWJ 06/12/2017
subjectLists; %load lists of subjects
subjects = PD_subjects;
%codeDir = '~pwjones/Documents/RichardsonLab/matlab/SpeechPilotPD-ET';
%basedir = '/Volumes/ToughGuy/RichardsonLabData/ET';
basedir='\\136.142.16.9\Nexus\Electrophysiology_Data\DBS_Intraop_Recordings';
%basedir='/Volumes/Nexus/Electrophysiology_Data/DBS_Intraop_Recordings';
%%
for s=1:length(subjects)
subjDir = [basedir filesep subjects{s} filesep 'Preprocessed Data'];
tmp=dir([subjDir filesep 'DBS*.mat']);
%tmp = dir([datadir filesep 'DBS*.mat']);
for ii=1:length(tmp)
data=load([subjDir filesep tmp(ii).name]);
% if ~isfield(data, 'Ecog')
% ecogi = strncmp('Strip', data.labels, 5);
% data.Ecog = data.filt(:,ecogi);
% data.EcogLabels = data.labels(ecogi);
% %data.labels = data.labels(~ecogi);
% %data.filt = data.filt(:,~ecogi);
%
% save([subjDir filesep tmp(ii).name], '-struct', 'data');
% end
changed = 0;
if ~isfield(data, 'SubjectID')
name = strtok(tmp(ii).name, '_');
data.SubjectID = name;
changed = 1;
end
if ~isfield(data, 'Side')
sidecell = cell2mat(data.side);
if strcmpi(sidecell(1), 'L')
data.Side = 'Left';
else
data.Side = 'Right';
end
changed=1;
end
if changed
save([subjDir filesep tmp(ii).name], '-struct', 'data');
end
end
end