TEAP (Toolbox for Emotion Analysis using Physiological Signals) doc
loading_DEAP.m
Go to the documentation of this file.
1 %we assume the pre-processed physilogical signals in mat file from DEAP data is being used
2 %this script loads the DEAP data and converts it to the EEGLAB format that
3 %is readable by TEAP
4 %I added minimally required fields to the structure
5 %Mohammad Soleymani June 2015 mohammad.soleymani@unige.ch
6 function loading_DEAP(physio_files_path)
7 %Takes the path physio_files_path and writes the mat files in eeglab format
8 %acceptable by TEAP
9 
10 electrode_labels = {'Fp1', 'AF3', 'F3', 'F7', 'FC5', 'FC1', 'C3', 'T7', 'CP5', ...
11  'CP1', 'P3', 'P7', 'PO3', 'O1', 'Oz', 'Pz', 'Fp2', 'AF4', ...
12  'Fz', 'F4', 'F8', 'FC6', 'FC2', 'Cz', 'C4', 'T8', 'CP6', ...
13  'CP2', 'P4', 'P8', 'PO4', 'O2','hEOG','vEOG','zEMG','tEMG','GSR','RESP','BVP','HST'};
14 
15 
16 
17 
18 phys_data.srate = 128;
19 phys_data.ref= 'common';
20 phys_data.trials = 40;
21 phys_data.nbchan=41; %added one since ground is added
22 phys_data.epoch = 1:40;
23 for i = 1:40
24  phys_data.chanlocs(i).labels = electrode_labels{i};
25 end
26 phys_data.chanlocs(41).labels = 'GND'; %ground channel
27 for subject=1:32
28  fprintf('loading and converting subject %0.2d\n',subject);
29  %file name to load
30  mat_file = sprintf('%s/s%0.2d.mat',physio_files_path,subject);
31  load(mat_file);
32  ratings{subject} = labels;
33  % we add a zero channel to be used as the second lead for the EMG
34  % signal
35  phys_data.data = zeros(size(data,2)+1,size(data,3),size(data,1));
36  for epoch = 1:40
37  for chan = 1:40
38  phys_data.data(chan,:,epoch) = squeeze(data(epoch, chan, :));
39  end
40  end
41  eeglab_file = sprintf('%s/s%0.2d_eeglab.mat',physio_files_path,subject);
42  save(eeglab_file,'phys_data');
43 end
44 
45 fprintf('Done! Successfully converted the mat files\n',subject);
loading_DEAP
function loading_DEAP(in physio_files_path)