-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathge_tapBlockImport.m
35 lines (32 loc) · 1.18 KB
/
ge_tapBlockImport.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
function ge_tapBlockImport(files, outfile)
% ge_tapBlockImport(files, outfile)
%
% Imports a block of files in the required format for Dom Parrott's "TAP"
% experiments. Uses the ge_parrottImport.m function to resolve markers and
% pre-process data. Uses a dir() object as input! (Will break on a list or
% some other format.
%
% MDT
% 2016.06.13
% Version 0.8.3
fid = fopen(outfile,'w');
for file = files'
% Subject and condition data:
cleanname = regexprep(file.name, '\.edf|\.set$','');
namelist = strsplit(cleanname, '-');
subnum = regexprep(namelist{1}, '^SUB|sub|Sub','');
eyeorder = namelist{2};
seqorder = namelist{3};
% Data analysis to get AIS's:
x = ge_parrottImport(file.name);
% Write the "obvious" data to the file
fprintf(fid, '%s,%s,%s,%s,', subnum, seqorder, eyeorder, file.name);
fprintf(fid, '%f,%f,%f,%f,%f,%f,%f,', x{3});
fprintf(fid, '%f,%f,%f,%f,%f,%f,%f,', x{4});
% Also the averages:
avgx = (x{3} + x{4})./2;
fprintf(fid, '%f,%f,%f,%f,%f,%f,%f\n', avgx);
end
fclose(fid);
fclose('all'); % Testing to fix the matlab open file bug!
end