-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathGET_TRIALCHANGES.m
65 lines (41 loc) · 2.03 KB
/
GET_TRIALCHANGES.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
clear; %clear environment variables
clc; %clear command window
format compact; %tömören mutassa a parancssor kimenetét
global LOGLEVEL
% LOGLEVEL = 1; % nothing
% LOGLEVEL = 2; % info only
% LOGLEVEL = 3; % info and warning too
LOGLEVEL = 4; % info, warning and debug too
% --------------------------------------------------
% CONFIG
Config.ExpDirName = 'NBACK_ver1_s1_MUTUAL_BE';
% Config.ExpDirName = 'NBACK_ver1_s2_MUTUAL_BE';
Config.ETDataFormat = 'SMI';
% Config.ETDataFormat = 'PupilEXT';
% Config.ETDataFormat = 'EyeLink';
% --------------------------------------------------
% PREPARE VARIABLES
Meta.RootDirTag = [strrep(Config.ExpDirName,' ','_')];
Meta.CfPrefix = [strrep(Config.ExpDirName,' ','_') '_'];
Meta.RootDirTag = [Meta.RootDirTag '_' Config.ETDataFormat];
disp(['Using eye tracker data format: ' Config.ETDataFormat]);
Config = support_DefineETDataSpecs(Config);
Participants = support_FindParticipantsByFiles(Config, ['~RAWDATA/' Config.ETDeviceDirName '/*' Config.ExpDirName], Config.ETDataFileNameEnding);
% --------------------------------------------------
% PROCESS AND SAVE
for ppnr = 1:length(Participants)
Participant.ID = Participants{ppnr};
Participant.Nr = ppnr;
disp('--------------------------------------------------');
log_i(['Currently processing ' char(Participants(ppnr)) ' at index ' num2str(ppnr)]);
Config.PXorMM = true;
ETData = GetData(['~RAWDATA/' Config.ETDeviceDirName '/' Config.ExpDirName], char(Participants(ppnr)), Config.ETDataFormat, Config.PXorMM);
timestamp = ETData.Samples.Ts;
pupdil = ETData.Samples.Pupdil;
T = support_findTrialChanges(ETData.Triggers.Trial, ETData.Triggers.Ts);
outFilePath = ['~RESULTS/' Meta.RootDirTag '/' 'Trial changes' '/' ];
mkdir(outFilePath);
outFileName = [char(Participants(ppnr)) '_trial_changes' '_' Config.ETDataFormat '.xls']; % no prefix here
writetable(T, [outFilePath outFileName]);
clearvars timestamp trial pupdil;
end