[Eeglablist] Removing event manually
Martin Simoneau
Martin.Simoneau at kin.ulaval.ca
Fri Oct 23 13:25:27 PDT 2020
Dear Isil and Dan,
Thanks for your suggestions.
I should have told the whole story. I get double DIN (markers) during data acquisition, and I want to keep the first DIN. For example, if another DIN4 follows within 1000 ms (problem with reading DIN) a DIN4, I remove the second DIN4.
Here is my script that does that without messing up with the dataset:
vecRemove = ones(1,length(EEG.event));
for n = 2:length(EEG.event)
if strcmp(EEG.event(n).type,'DIN4') == 1 && (EEG.event(n).latency - EEG.event(n-1).latency) < 1000
vecRemove(1,n) = 0;
elseif strcmp(EEG.event(n).type,'DIN2') == 1 && (EEG.event(n).latency - EEG.event(n-1).latency) < 1000
vecRemove(1,n) = 0;
elseif strcmp(EEG.event(n).type,'DIN3') == 1 && (EEG.event(n).latency - EEG.event(n-1).latency) < 1000
vecRemove(1,n) = 0;
elseif strcmp(EEG.event(n).type,'DIN5') == 1 && (EEG.event(n).latency - EEG.event(n-1).latency) < 1000
vecRemove(1,n) = 0;
elseif strcmp(EEG.event(n).type,'DIN6') == 1 && (EEG.event(n).latency - EEG.event(n-1).latency) < 1000
vecRemove(1,n) = 0;
end
end
EEG = pop_editeventvals(EEG,'delete',find(vecRemove == 0));
I just double-checked, and it is working! I will check other datasets to make sure it is robust.
Thanks for your help,
Martin
De : Isil Bilgin <bilginlab at gmail.com>
Envoyé : vendredi 23 octobre 2020 16:18
À : Martin Simoneau <Martin.Simoneau at kin.ulaval.ca>
Cc : eeglablist at sccn.ucsd.edu
Objet : Re: [Eeglablist] Removing event manually
[Externe UL*]
Dear Martin,
Just addition to Dan's suggestion, if you know the index of the epochs you want to remove from you can also create an array of those event indices (e.g. events2remove) and feed it to the below EEGLAB function which should remove the unwanted events without harming the EEGLAB data structure.
EEG = pop_select( EEG,'notrial',events2remove);
Hope it helps,
Kind regards,
----
Isil Bilgin
PhD Researcher,
Biomedical Engineering,
The University of Reading,
On Fri, Oct 23, 2020 at 5:51 PM Martin Simoneau <Martin.Simoneau at kin.ulaval.ca<mailto:Martin.Simoneau at kin.ulaval.ca>> wrote:
Dear EEGlab users,
I want to remove events manually. Here is my MATLAB script. I want to make sure that this is not going to mess up my dataset.
listDINs = {EEG.event.type};
% remove boundary, for example
for n = 1:length(listDINs)
if strcmp(EEG.event(n).type),'boundary')
EEG.event(n).type = [];
EEG.event(n).description = [];
EEG.event(n).begintime = [];
EEG.event(n).classid = [];
EEG.event(n).code = [];
EEG.event(n).duration = [];
EEG.event(n).label = [];
EEG.event(n).relativebegintime = [];
EEG.event(n).sourcedevice = [];
EEG.event(n).name = [];
EEG.event(n).tracktype = [];
EEG.event(n).latency = [];
EEG.event(n).mffkeys = [];
EEG.event(n).mffkeys_gidx = [];
EEG.event(n).mffkeys_cidx = [];
EEG.event(n).mffkeysbackup = [];
end
end
I am sure it is necessary to set all fields to []; otherwise, it should be confusing for EEGlab to sort things out. However, I want to make sure that this script will not cause any damage to my dataset.
Thanks for your help,
Martin
Martin Simoneau, PhD
Professeur | Professor
Faculté de médecine - Département de kinésiologie
2300, rue de la Terrasse (PEPS)
Université Laval
Québec, (Qc) Canada
G1V 0A6
Chercheur | Researcher
Centre interdisciplinaire de recherche en réadaptation et intégration sociale (CIRRIS)
525 boul. Wilfrid-Hamel, Québec (Qc), Canada, G1M 2S8
_______________________________________________
Eeglablist page: http://sccn.ucsd.edu/eeglab/eeglabmail.html
To unsubscribe, send an empty email to eeglablist-unsubscribe at sccn.ucsd.edu<mailto: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<mailto:eeglablist-request at sccn.ucsd.edu>
*ATTENTION : L’émetteur de ce courriel est externe à l’Université Laval.
Évitez de cliquer sur un hyperlien, d’ouvrir une pièce jointe ou de transmettre des informations si vous ne connaissez pas l’expéditeur du courriel. En cas de doute, contactez l’équipe de soutien informatique de votre unité ou hameconnage at ulaval.ca<mailto:hameconnage at ulaval.ca>.
________________________________
More information about the eeglablist
mailing list