[Eeglablist] Events not listed when extracting epochs with pop_epoch

Mikołaj Magnuski imponderabilion at gmail.com
Sat Sep 15 10:29:07 PDT 2012


Oops, sorry, I noticed that I didn't include negation in the checking
script.
It should be:

types = unique({EEG.event.type});
which_have_spaces = ~cellfun(@isempty, regexp(types, ' '));
types_with_spaces = types(which_have_spaces);


If you then need to remove spaces from event.types you could try:

for i = 1:length(EEG.event)
if ischar(EEG.event(i).type)
EEG.event(i).type = strtrim(EEG.event(i).type);
end
end

(and the same for EEG.urevent)

and then you could execute:
[ALLEEG EEG] = eeg_store(ALLEEG, EEG, CURRENTSET);


This should at least help with the pop_epoch error.
The code above will work for one dataset only,
if you want to update all loaded datasets, you
would have to loop through these sets, for example
by embracing the code above with:

for a = 1:length(ALLEEG)
[EEG ALLEEG CURRENTSET] = eeg_retrieve( ALLEEG, a);
% and here the previous code looping through events and urevents
end

Mikolaj



2012/9/15 Mikołaj Magnuski <imponderabilion at gmail.com>

>
> Becky,
>
> It may be relevant to your problem that at least one of
> your event types has trailing spaces (the one that you
> presented as example - 55).
>
> As you wrote matlab displays the type as:
> type: '55  '
>
> which means there are two spaces after two five characters.
> I'm not sure if it should make any difference for
> EEGLAB in displaying event types, but it could cause
> the error you report (empty epoch range), because you
> may not have any '55' event types, but '55  ' instead.
>
> You may do a quickcheck of this by coping the following code:
>
> types = unique({EEG.event.type});
> which_have_spaces = cellfun(@isempty, regexp(types, ' '));
> if ~isempty(which_have_spaces)
> types_with_spaces = types(which_have_spaces);
> end
>
> If this is the case you could then deblank all the events
> and urevents by looping through them and see if it makes
> any difference.
> Anyway, once you find your spaced event types, you could
> also try using pop_epoch again, but with correct event
> types.
>
> Mikolaj
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://sccn.ucsd.edu/pipermail/eeglablist/attachments/20120915/519fc03b/attachment.html>


More information about the eeglablist mailing list