[Eeglablist] Add data channel

Mario Reutter mario.reutter at gmail.com
Fri May 12 01:49:53 PDT 2017


Hi there,

I found this thread from 2011 via Google since I had the same problem and I
wrote a tiny function that correctly adds a channel at the end of EEG data
(I'm using version 13.6.5b):

function [EEG] = addChannel(EEG, values, label)
if isempty(values)
    values = 0;
end

EEG.data(end+1,:) = values;
EEG.nbchan = size(EEG.data,1);
EEG.chanlocs(end+1).labels = label;

In Arno's answer, the label was not set correctly since the corresponding
field is called "labels" and not "label".

Best wishes,
Mario
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://sccn.ucsd.edu/pipermail/eeglablist/attachments/20170512/9d28d831/attachment.html>


More information about the eeglablist mailing list