[Eeglablist] deleting time segments in continuous data based on event codes

Makoto Miyakoshi mmiyakoshi at ucsd.edu
Fri Aug 19 17:44:18 PDT 2022


Dear Fredrik,

Here is the core part of the process in a pseudo code.

% Obtain event indices for 1 and 99
index1 = contains({EEG.event.type}, '1');
index99 = contains({EEG.event.type}, '99');

% Obtain their latencies (rounded) Note that there must be the same number
of index1 and index99.
index1Latency = round(EEG.event(index1).latency);
index99Latency = round(EEG.event(index99).latency);

% Obtain the time indices for all the intervals between index1 and index99.
deletingIndex = [];
for loopIdx = 1:length(index1Latency)
    deletingIndex = [deletingIndex
index1Latency(loopIdx):index99Latench(loopIdx)];
end

% Delete all the data points that are between index1 and index99
EEG.data(:, deletingIdx) = [];

This deletes all the data points between 1 and 99.
If you need further help, please let me know.

Makoto


On Fri, Jul 29, 2022 at 11:42 AM fredrik heinat via eeglablist <
eeglablist at sccn.ucsd.edu> wrote:

> Dear all,
>
> I have data from a linguistic RSVP-experiment where participants have
> read sentences. Every sentence starts with a fixation cross with event
> code 1 and the end of the final word has eventcode 99, and there are no
> other event codes between sentences. The sentences are not of equal
> length and the time between sentences varies too since the participants
> decide themselves when to start the next sentence. In preparation for
> ICA it would be really nice with a script that could delete the time
> periods between 99 and 1 (the end of a sentence and the start of the
> next one) since the periods between sentences contain a lot of EMG and
> eye movements unrelatede to the study. I've not been able to find
> anything  on the list, or elsewhere, that can remove time periods in
> continuous data which is not based on certain fixed time periods between
> events. I've tried the script:
>
> https://urldefense.com/v3/__https://github.com/lucklab/erplab/blob/master/pop_functions/pop_erplabDeleteTimeSegments.m__;!!Mih3wA!Cl_njzFlp18yt-kI7_EPMV8MKxkoPuOhFb6jrVWR4mqxs0ubb6GwRrSioUtcMSVTkizps3iZGuYt_aNRAZNjgw2S8HoZdw$
>
> but I can't get it to work. The problem is that the between sentence
> interval can be both longer and shorter than the one between any
> critical events in the sentences so a specific time intervall can't be
> specified. I'm not used to Matlab programming and I'd appreciate any
> help I can get.
>
> Best,
> Fredrik
> _______________________________________________
> 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



More information about the eeglablist mailing list