-
Notifications
You must be signed in to change notification settings - Fork 0
/
merge_epochs.m
113 lines (66 loc) · 3.25 KB
/
merge_epochs.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
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
clear all
clc
close all
data_dir='/autofs/space/voima_001/users/awmrc/';
fid=fopen('/autofs/space/taito_005/users/fahimeh/doc/txt/list_1.txt');
C=textscan(fid,'%s%s');
subjects=C{1,1};
visitNo=C{1,2};
conds=[1002 1005 1008 1011 1014 1017 2002 2005 2008 2011 2014 2017 2102 2105 2108 2111 2114 2117];
%7 8 9 10 11 12 13 14 15 16 17 18];
k=1;
for isubj=3:length(subjects)
subj=subjects{isubj};
try
for icond=1:length(conds)
cond=conds(icond);
if ~exist([data_dir 'epochMEG/Epochs_sensor_' subj '_run_all' '_cond_' num2str(cond) '.mat'],'file')
A= load([data_dir 'epochMEG/Epochs_sensor_' subj '_run_' num2str(1) '_cond_' num2str(cond) '.mat']);
B= load([data_dir 'epochMEG/Epochs_sensor_' subj '_run_' num2str(2) '_cond_' num2str(cond) '.mat']);
C= load([data_dir 'epochMEG/Epochs_sensor_' subj '_run_' num2str(3) '_cond_' num2str(cond) '.mat']);
D= load([data_dir 'epochMEG/Epochs_sensor_' subj '_run_' num2str(4) '_cond_' num2str(cond) '.mat']);
data.all_epochs=cat(3,A.data(:,:,A.cfg.indgood),B.data(:,:,B.cfg.indgood),C.data(:,:,C.cfg.indgood),D.data(:,:,D.cfg.indgood));
data.cfg{1}=A.cfg;
data.cfg{2}=B.cfg;
save([data_dir 'epochMEG/Epochs_sensor_' subj '_run_all' '_cond_' num2str(cond) '.mat'],'data')
end
end
catch
failed{k}=fileData;
k=k+1;
end
end
%%
clear all
clc
close all
data_dir='/autofs/space/voima_001/users/awmrc/';
fid=fopen('/autofs/space/taito_005/users/fahimeh/doc/txt/list_1.txt');
C=textscan(fid,'%s%s');
subjects=C{1,1};
visitNo=C{1,2};
conds=[3002,3005,3008,3011,3014,3017];
%7 8 9 10 11 12 13 14 15 16 17 18];
k=1;
for isubj=13:18
subj=subjects{isubj};
try
for icond=1:length(conds)
cond=conds(icond);
% if ~exist([data_dir 'epochMEG/Epochs_sensor_' subj '_run_all' '_cond_' num2str(cond) '.mat'],'file')
A= load([data_dir 'epochMEG/Epochs_sensor_' subj '_run_' num2str(1) '_cond_' num2str(cond) '.mat']);
B= load([data_dir 'epochMEG/Epochs_sensor_' subj '_run_' num2str(2) '_cond_' num2str(cond) '.mat']);
C= load([data_dir 'epochMEG/Epochs_sensor_' subj '_run_' num2str(3) '_cond_' num2str(cond) '.mat']);
D= load([data_dir 'epochMEG/Epochs_sensor_' subj '_run_' num2str(4) '_cond_' num2str(cond) '.mat']);
data.all_epochs=cat(3,A.data(:,:,A.cfg.indgood),B.data(:,:,B.cfg.indgood),C.data(:,:,C.cfg.indgood),D.data(:,:,D.cfg.indgood));
data.cfg{1}=A.cfg;
data.cfg{2}=B.cfg;
size_data(isubj,icond)=size(data.all_epochs,3);
save([data_dir 'epochMEG/Epochs_sensor_' subj '_run_all' '_cond_' num2str(cond) '.mat'],'data')
% end
end
catch
failed{k}=fileData;
k=k+1;
end
end