[Eeglablist] Retain EEG structures after splitting file

Makoto Miyakoshi mmiyakoshi at ucsd.edu
Tue May 5 09:58:53 PDT 2015

Dear Brian,

It seems my colleagues have been using EEG.etc as such a user-added data.

I have a present for you Brian. See below. These are the tricks to deal
with EEG.event without using for loop.


% rename events-this is a new effective method!
    allEvent = cell2mat({EEG.event.type}');
    idx2049 = find(allEvent==2049); [EEG.event(idx2049).type] = deal(8049);
    idx2050 = find(allEvent==2050); [EEG.event(idx2050).type] = deal(8050);
    idx2051 = find(allEvent==2051); [EEG.event(idx2051).type] = deal(8051);

% another trick
dummyA = num2cell(EEGsuggestedLatencyForFixationOnsets);
[EEG.event(Idx).latency] = dummyA{:};

% adding 400ms to specific events
allEvent = {EEG.event.type}';
stroopOnsetIdx  = find(strcmp(allEvent, 'VolMov_fixationbegin'));
stroopOnsetLatencyInFrame  = [EEG.event(stroopOnsetIdx).latency]';
modifiedValues = num2cell(bsxfun(@plus, stroopOnsetLatencyInFrame, 400),2);
[EEG.event(stroopOnsetIdx).latency] = modifiedValues{:};

    % extract event labels and time stamps
    allEventLabels = mobilab.allStreams.item{eventStreanIdx}.event.label;
    eventTimeStamp = mobilab.allStreams.item{eventStreanIdx}.timeStamp; %
in second

    % import event markers and latency to EEG.event
    allEventLatency = num2cell((eventTimeStamp-EEG.urxmin)*1000);
    allUrevent      = num2cell(1:length(allEventLatency));
    EEG.event = struct('type', {}, 'latency',{}, 'urevent',{});
    [EEG.event(1,1:length(allEventLabels)).latency] = allEventLatency{:};
    [EEG.event(1,1:length(allEventLabels)).type]    = allEventLabels{:};
    [EEG.event(1,1:length(allEventLabels)).urevent] = allUrevent{:};
    EEG = eeg_checkset(EEG,'eventconsistency');

On Thu, Apr 23, 2015 at 9:51 AM, Brian Scally <scallybrian at gmail.com> wrote:

> Hi all,
> I've added a variable to the EEG.epoch structure, e.g. EEG.epoch.index,
> and coded each epoch for identification later. When I split the set into
> two new sets of epochs, the variable I added gets lost and the original
> epochs are no longer coded. Is there a way I can retain that information?
> Have tried all checkset commands etc.
> Cheers
> --
> Brian
> _______________________________________________
> Eeglablist page: http://sccn.ucsd.edu/eeglab/eeglabmail.html
> To unsubscribe, send an empty email to
> eeglablist-unsubscribe at sccn.ucsd.edu
> For digest mode, send an email with the subject "set digest mime" to
> eeglablist-request at sccn.ucsd.edu

Makoto Miyakoshi
Swartz Center for Computational Neuroscience
Institute for Neural Computation, University of California San Diego
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://sccn.ucsd.edu/pipermail/eeglablist/attachments/20150505/165ee873/attachment-0001.html>

More information about the eeglablist mailing list