[Eeglablist] Renaming events in EEGLAB – is modifying EEG.event.type enough?

Cedric Cannard ccannard at protonmail.com
Fri Nov 7 09:51:06 PST 2025


Hi Florencia,

Here is an example:

% Make sure event types are char

for i = 1:length(EEG.event)

EEG.event(i).type = char(string(EEG.event(i).type));

end

% Rename DI50 to DI56 when incorrect

for i = 1:length(EEG.event)

if strcmpi(EEG.event(i).type,'DI50') ...

&& isfield(EEG.event(i),'correct') ...

&& EEG.event(i).correct == 0

EEG.event(i).type = 'DI56';

end

end

% Check

EEG = eeg_checkset(EEG,'eventconsistency');

EEG = eeg_checkset(EEG);

Cedric

Sent from [Proton Mail](https://urldefense.com/v3/__https://proton.me/mail/home__;!!Mih3wA!CH2xa5W66LrKhPh-jgcJgS7HCjEKmaMGqWMzx8_O14OkMaVstsroBrxZ-iJGuAFhl8zXAdB_Li_nNVVzDqaYVnAHVw$ ) for iOS.

-------- Original Message --------
On Tuesday, 11/04/25 at 14:42 Florencia Sanmartino <florenciasanmartino at gmail.com> wrote:

> Hi Cedric,
>
> Thanks a lot for your reply!
>
> I’ll update EEG.event.type directly and run the consistency checks as you suggested.
>
> I’d really appreciate it if you could share the code template.
>
> I also noticed that EEG.event has a few other fields related to the event name. Should I update those too, or is it fine to just change type?
>
> Best,
>
> Florencia.
>
> El mar, 4 nov 2025 a la(s) 9:14 p.m., Cedric Cannard via eeglablist (eeglablist at sccn.ucsd.edu) escribió:
>
>> Hi Florencia,
>>
>> If you are just renaming the events, it should be enough yes. Just make sure they are a character string.
>> And run this to check at the end:
>>
>> EEG = eeg_checkset(EEG, 'eventconsistency');
>> EEG = eeg_checkset(EEG);
>>
>> I can give a code template if needed.
>>
>> Cedric Cannard
>>
>> On Tuesday, November 4th, 2025 at 8:16 AM, Florencia Sanmartino via eeglablist <eeglablist at sccn.ucsd.edu> wrote:
>>
>>> Hi everyone,
>>>
>>>
>>>
>>> I'm new to EEGLAB and would appreciate some guidance on how to safely
>>> rename events in a continuous dataset.
>>>
>>> I imported a .mff file that contains multiple events, and I’d like to
>>> rename some of them based on participants’ responses (for instance, if an
>>> event is labelled DI50 and the participant responded incorrectly, I want to
>>> change it to DI56).
>>>
>>> I tried doing this manually through Edit > Event values > type, but since
>>>
>>> there are many events, I’d like to automate the process. I also tried
>>> exporting the events to a text file, editing it, and importing it back, but
>>> that caused import errors.
>>>
>>> So, I’d like to rename the events directly in MATLAB. Is it sufficient to
>>> modify EEG.event.type directly in a script, or are there other fields or
>>> consistency checks I should run to make sure the dataset structure remains
>>> valid for later steps?
>>>
>>>
>>>
>>> Thanks in advance.
>>> Florencia
>>> _______________________________________________
>>> To unsubscribe, send an empty email to eeglablist-unsubscribe at sccn.ucsd.edu or visit https://urldefense.com/v3/__https://sccn.ucsd.edu/mailman/listinfo/eeglablist__;!!D9dNQwwGXtA!RWgv4n2_5s7qVoPIYZ8pMasc-1HejnJIQ9UNaTW0L7OW5YLtnrzrGPD7uGzv_ic9a9S6C_K-pkWFmWg5OrOJUyQVoiRN4D7n$ .
>> _______________________________________________
>> To unsubscribe, send an empty email to eeglablist-unsubscribe at sccn.ucsd.edu or visit https://urldefense.com/v3/__https://sccn.ucsd.edu/mailman/listinfo/eeglablist__;!!D9dNQwwGXtA!RWgv4n2_5s7qVoPIYZ8pMasc-1HejnJIQ9UNaTW0L7OW5YLtnrzrGPD7uGzv_ic9a9S6C_K-pkWFmWg5OrOJUyQVoiRN4D7n$ .


More information about the eeglablist mailing list