[Eeglablist] use variable instead of numeric in pop_selectevent

Cedric Cannard ccannard at protonmail.com
Mon Jun 21 12:11:29 PDT 2021

Interesting, I don’t remember seeing ranges before. The latency field in EEG.event refers normally to the exact position of your marker in ms. So I don’t see how you could have a range here.

I’m confused about what you are trying to do. Generally, using something like 2<=100 would return a logical value (true or false), so I don’t see how that could work in the event structure. The way you wrote it suggests you are naming the event in a character string, so it would appear ‘2<=100’ to describe this event, but it wouldn’t calculate any logic in this. You would generally have your condition with a ‘if’ function within your loop. If value is <= 100, then name the event this way. Else, name it this way.


On Mon, Jun 21, 2021 at 10:08, Kathleen Van Benthem <kathy_vanbenthem at carleton.ca> wrote:

> Hi Cedric,
> Thanks for your quick reply.
> The pop_selectevent code does permit ranges.
> I have no problem running the code when I use the latency key with numeric ranges e.g., '2<=100', for example.
> The challenge is when I try to replace numerics with variables (e.g., 'a<=b' instead of '2<=100' ) as you would do when you are looping through all the eeg files in a folder. I have tried curly brackets and extra apostrophes etc.. so that the values of the defined variables would be used in the latency constraint, but not had any luck).
> Any ideas!
> thanks,
> Kathleen
> Kathleen Van Benthem Ph.D., Senior Research Scientist, Advanced Cognitive Engineering Laboratory
> Adjunct Research Professor, Department of Cognitive Science,
> Carleton University, Ottawa, ON. Canada. K1S5B6
> kathy.vanbenthem at carleton.ca
> Phone: (613) 355-2515
> On Mon, Jun 21, 2021 at 12:06 PM Cedric Cannard <ccannard at protonmail.com> wrote:
>> [External Email]
>> Hi Kathleen,
>> I believe this is because latency can only have one number (e.g. a)  whereas you have two with [a, b].
>> Cédric
>> On Mon, Jun 21, 2021 at 08:06, Kathleen Van Benthem via eeglablist <eeglablist at sccn.ucsd.edu> wrote:
>>> Hello Lablist,
>>> Within a loop of many files, I need to change event names according to
>>> latency ranges using the script below (ranges change for each file being
>>> processed).
>>> I have defined a and b based on the dynamically changing values. This
>>> throws errors that I need to use numbers, not variables.
>>> Is there a way that I can do this? BTW, 'a<=b' also does not work.
>>> EEG = pop_selectevent( EEG,
>>> 'latency',[a,b],'type',{'9999'},'renametype','4111','deleteepochs',
>>> 'off','deleteevents','off');
>>> Kathleen, Carleton University
>>> _______________________________________________
>>> 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
>> This email contains links to content or websites. Always be cautious when clicking on external links or attachments. If in doubt, please forward suspicious emails to phishing at carleton.ca.
>> -----End of Disclaimer-----

More information about the eeglablist mailing list