[Eeglablist] presenting epochs one above the other

Mikołaj Magnuski imponderabilion at gmail.com
Sat May 17 17:06:31 PDT 2014


The simplest (but not necessarily most efficient) way of doing this is:

1. Load the data (using pop_loadset() for example or through the GUI)
2. Run this script (it should work correctly assuming you have
    more epochs than channels):

%%%%%%

% get size of data and allocate new data matrix
Siz = size(EEG.data);
NewData = zeros(fliplr(Siz));

% restrucutre the data
for i = 1:Siz(1)
    NewData(:, :, i) = squeeze(EEG.data(i, :, :))';
end

% update relevant fields
EEG.data = NewData;
EEG.nbchan = Siz(3);
EEG.trials = Siz(1);

% add fake channel info:
addchn = Siz(3) - Siz(1);

for a = 1:addchn
    num = num2str(rand(1));
    fakename = ['ch_', num(3:5)];
    EEG.chanlocs(Siz(1)+a) = EEG.chanlocs(Siz(1) - mod(a, Siz(1)));
    EEG.urchanlocs(Siz(1)+a) = EEG.urchanlocs(Siz(1) - mod(a, Siz(1)));
    EEG.chanlocs(Siz(1)+a).labels = fakename;
    EEG.urchanlocs(Siz(1)+a).labels = fakename;
end

% trim the epoch structure
EEG.epoch(end -(addchn - 1):end) = [];

% redraw eeglab GUI
eeglab redraw
clear NewData a num fakename Siz i addchn

%%%%%%

3. Now using standard channel (scroll) plotting
    will show you epochs as electrodes and vice
    versa. If it does not work correctly - let me know.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://sccn.ucsd.edu/pipermail/eeglablist/attachments/20140518/e271dfe0/attachment.html>


More information about the eeglablist mailing list