TEAP (Toolbox for Emotion Analysis using Physiological Signals) doc
EEG_aqn_variable.m
Go to the documentation of this file.
1 %This file is part of TEAP.
2 %
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.
7 %
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.
12 %
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/>.
15 %
16 %> @file EEG_aqn_variable.m
17 %> @brief EEG_aqn_variable gets an EEG signal from a variable.
18 %
19 %> @param eegChannels [Cxstrings]: a vector specifying the C EEG channels given
20 %> @param eegData [CxN]: a matrix containing the EEG data
21 %> @param sampRate [1x1]: the sampling rate, in Hz
22 %
23 %> @retval Signal: An EEG TEAP signal
24 function Signal = EEG_aqn_variable(eegChannels, eegData, sampRate)
25 
26 if(nargin ~= 3)
27  error('Usage: Signal = EEG_aqn_variable(eegChannels, eegData, sampRate');
28 end
29 
30 
31 Signal = EEG__new_empty();
32 Signal = Signal__set_samprate(Signal, sampRate);
33 
34 nChannels = length(eegChannels);
35 [nChannelsGiven, ~] = size(eegData);
36 
37 if(nChannelsGiven ~= nChannels)
38  error(['Hey, you said that you''d give me ' num2str(nChannels) ...
39  'channels but you gave me ' num2str(nChannelsGiven) ' instead']);
40 end
41 
42 for(i = [1:nChannels])
43  chaname = strtrim(eegChannels{i});
44  Signal = EEG_set_channel(Signal, chaname, eegData(i, :));
45 end
46 
EEG__new_empty
function EEG__new_empty()
Signal__set_samprate
function Signal__set_samprate(in Signal, in samprate)
EEG_aqn_variable
function EEG_aqn_variable(in eegChannels, in eegData, in sampRate)
EEG_set_channel
function EEG_set_channel(in Signal, in channelName, in channelData)