1 %This file is part of TEAP.
3 %TEAP is free software: you can redistribute it and/or modify
4 %it under the terms of the GNU General Public License as published by
5 %the Free Software Foundation, either version 3 of the License, or
6 %(at your option) any later version.
8 %TEAP is distributed in the hope that it will be useful,
9 %but WITHOUT ANY WARRANTY; without even the implied warranty of
10 %MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 %GNU General Public License
for more details.
13 %You should have received a copy of the GNU General Public License
14 %along with TEAP. If not, see <http://www.gnu.org/licenses/>.
17 %> @brief Loads an EEGLab variable, into a TEAP bulk signal, containing EEG, ECG,
20 %> @param EEGV the variable given by EEGLab (ex: load A.mat;
Bulk_load_eeglab(EEG))
22 %> @retval BulkSig a TEAP bulk signal vector
25 %Copyright Frank Villaro-Dixon, 2014
28 error(
'Usage: BulkSig = Bulk_load_eeglab(EEGV)');
33 nEpochs = length(EEGV.epoch);
37 for iEpoch = [1:nEpochs]
40 Bulk =
addEEG(Bulk, iEpoch);
41 Bulk =
addGSR(Bulk, iEpoch);
42 Bulk =
addHST(Bulk, iEpoch);
43 Bulk =
addRES(Bulk, iEpoch);
44 Bulk =
addBVP(Bulk, iEpoch);
46 BulkSig(iEpoch) = Bulk;
52 function BulkSig =
addEEG(BulkSig, iEpoch);
53 correspondance = [
'Fp1';
'AF3';
'F3';
'F7';
'FC5';
'FC1';
'C3';
'T7';
'CP5'; ...
54 'CP1';
'P3';
'P7';
'PO3';
'O1';
'Oz';
'Pz';
'Fp2';
'AF4'; ...
55 'Fz';
'F4';
'F8';
'FC6';
'FC2';
'Cz';
'C4';
'T8';
'CP6'; ...
56 'CP2';
'P4';
'P8';
'PO4';
'O2'];
58 numel = size(correspondance, 1);
59 datlen = length(EEGV.data(1, :, 1));
60 data = zeros(numel, datlen);
63 chaname = strtrim(correspondance(i, :));
65 % disp([
'Will do ' chaname
' - ' num2str(chan)]);
67 warning([
'The EEG channel ' correspondance(i, :)
' does not '...
68 'exist. Aborting EEG']);
71 data(1, :) = reshape(EEGV.data(chan, :, iEpoch), 1, datlen);
79 function BulkSig =
addGSR(BulkSig, iEpoch)
85 data = EEGV.data(GSRChannel, :, iEpoch);
86 reshaped = reshape(data, 1, length(data));
93 function BulkSig =
addHST(BulkSig, iEpoch)
99 data = EEGV.data(HSTChannel, :, iEpoch);
100 reshaped = reshape(data, 1, length(data));
107 function BulkSig =
addRES(BulkSig, iEpoch)
113 data = EEGV.data(RESChannel, :, iEpoch);
114 reshaped = reshape(data, 1, length(data));
121 function BulkSig =
addBVP(BulkSig, iEpoch)
127 data = EEGV.data(BVPChannel, :, iEpoch);
128 reshaped = reshape(data, 1, length(data));
137 for iChannel = [1:length(EEGV.chanlocs)]
138 % disp([
'Will compare ' chanName
' and ' EEGV.chanlocs(iChannel).labels]);
139 if(strcmp(chanName, EEGV.chanlocs(iChannel).labels) == 1)