[Eeglablist] Using variables in pop_selectevent

Cedric Cannard ccannard at protonmail.com
Fri Dec 23 06:49:15 PST 2022


Dear Arkadiy,

Here is the code to do what you need for events with a latency below 10000 samples (to edit with your fastval value). Note: this will convert all your events to character strings (which should not pose a problem later for STUDY). 

% index of events with latency below your threshold
evToRename = [EEG.event.latency] <= 10000; 

% Loop through events and rename events of interest using that index 
for iEv = 1:length(EEG.event)
    if evToRename(iEv)
        EEG.event(iEv).type = 'fastRTs';
    end
end
EEG = eeg_checkset(EEG); 


Cedric Cannard, PhD



------- Original Message -------
On Tuesday, December 20th, 2022 at 9:14 AM, Maksimovskiy, Arkadiy <AMAKSIMOVSKIY at MCLEAN.HARVARD.EDU> wrote:


> Dear EEGlab Users,
> 
> I am attempting to use the following function to rename events, which meet certain criteria (i.e., their latency is between two numbers):
> 
> EEGfastrts = pop_selectevent( EEG, 'latency',’0 <= fastval’,'type',{'AnyResponse'},'renametype','FastRTs','deleteevents','off','deleteepochs','off','invertepochs','off');
> 
> However, when I input a variable (i.e., fastval), instead of an int value, this function does not work.
> 
> I was wondering if anyone might have suggestions/work-arounds for using this function for a range that is represented (at least, partially) by a variable. This is important, since I intend to insert the function into a loop, which will alter the variable value with every iteration.
> 
> Thank you in advance for your thoughts and input.
> 
> -Arkadiy
> _____________________
> Arkadiy L. Maksimovskiy, Ph.D. (he/him/his)
> Assistant Neuroscientist, McLean Hospital
> Instructor in Psychiatry, Harvard Medical School
> 
> McLean Hospital
> 115 Mill Street, 225 deMarneffe, Belmont, 02478-1064
> https://urldefense.com/v3/__http://mclean.harvard.edu/__;!!Mih3wA!BmSTZtt_wNd437SilMYcHAiYsF1LQyfhr7Ot3J7l8ju8cbw11vJzhElOtlgTxD-QQbXY625qqf2c26qcfSmzEZK5f076dRPG2wu8WJA$
> The information in this e-mail is intended only for the person to whom it is addressed. If you believe this e-mail was sent to you in error and the e-mail contains patient information, please contact the Mass General Brigham Compliance HelpLine at https://urldefense.com/v3/__https://www.massgeneralbrigham.org/complianceline__;!!Mih3wA!BmSTZtt_wNd437SilMYcHAiYsF1LQyfhr7Ot3J7l8ju8cbw11vJzhElOtlgTxD-QQbXY625qqf2c26qcfSmzEZK5f076dRPG-NZCAW0$ <https://urldefense.com/v3/__https://www.massgeneralbrigham.org/complianceline__;!!Mih3wA!BmSTZtt_wNd437SilMYcHAiYsF1LQyfhr7Ot3J7l8ju8cbw11vJzhElOtlgTxD-QQbXY625qqf2c26qcfSmzEZK5f076dRPG-NZCAW0$ > .
> 
> Please note that this e-mail is not secure (encrypted). If you do not wish to continue communication over unencrypted e-mail, please notify the sender of this message immediately. Continuing to send or respond to e-mail after receiving this message means you understand and accept this risk and wish to continue to communicate over unencrypted e-mail.
> _______________________________________________
> 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