Why is matlab removing urevent structure?

2 views (last 30 days)
Bridget
Bridget on 3 Feb 2024
Edited: Sanju on 20 Feb 2024
When I load an existing data set, I am getting the following error message:
"Warning: Inconsistency between urevent (backup) and event structures, removing urevent structure"
eeg.urevent = []
I need eeg.urevent to see what trials were removed due to artifacts.
This is the code I have so far:
clear all
eeglab;
EEG = pop_loadset('/Users/Name/Desktop/Data/SubjectA.set');
The .set has some basic filters, then I extracted bin based epochs.
Thanks for your help!

Answers (1)

Sanju
Sanju on 15 Feb 2024
Edited: Sanju on 20 Feb 2024
Hi @Bridget,
The warning message you are seeing indicates that there is an inconsistency between the “urevent” and “event” structures in your EEG data. The “urevent” structure is typically used to store additional information about events, such as trial removal due to artifacts. In this case, the “urevent” structure is being removed, which means you won't be able to access the information about removed trials directly from “eeg.urevent”.
However, you can still access the information about removed trials by checking the “event” structure. The “event” structure contains information about all the events in your data, including the removed trials. You can use the type of field in the event structure to identify the removed trials.
you can modify the code to automatically detect the type of the removed trials. One way to do this is by iterating over the event structure and checking the unique types of events present in the data.
Here’s an example code you can refer to,
% Load the EEG data
EEG = pop_loadset('/Users/Name/Desktop/Data/SubjectA.set');
% Get the unique event types
eventTypes = unique({EEG.event.type});
% Check the event structure for removed trials
removedTrials = [];
for i = 1:length(EEG.event)
if any(strcmp(EEG.event(i).type, eventTypes))
removedTrials = [removedTrials, EEG.event(i).latency];
end
end
% Display the removed trials
disp(removedTrials);
In the above example, the code dynamically retrieves the unique event types present in the data using the unique function. Then, it checks if the type of each event matches any of the unique event types, and if so, adds the latency to the removedTrials array.
You can also refer to the below documentation links if required,
Hope this Helps!
  1 Comment
Bridget
Bridget on 15 Feb 2024
Thank you for your thoughtful answer @Sanju!
For anyone else having this problem, I solved it by downlaoding an older version of EEGLAB (2022.1). This restored urevent.

Sign in to comment.

Categories

Find more on EEG/MEG/ECoG in Help Center and File Exchange

Products


Release

R2023a

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!