Welcome! Log In Create A New Profile

Advanced

using pause() in adapter code

Posted by lucast4 
using pause() in adapter code
May 24, 2022 10:14AM
I added a pause(DELAY) statement in an adapter's fini() method, with the goal of simply adding a delay in the trial structure. DELAY is <0.4 seconds.
Is there a fundamental reason I should avoid this?
I have checked closely and nothing seems messed up (in runtime or in the data).
I understand that using another adapter, like TimeCounter() is better practice, but I wanted something to quickly add to the code.
Thanks!
Re: using pause() in adapter code
May 24, 2022 11:14AM
You should avoid it because it blocks the execution of the fini() method of the other adapters. Use idle() between the scenes in the timing script.
https://monkeylogic.nimh.nih.gov/docs_RuntimeFunctions.html#idle
Re: using pause() in adapter code
May 25, 2022 12:39PM
what I would like to do is actually delay the fini() for all adapters. So really what I need is a Sequential() chain, where there is a TimeCounter in between the two adaptors for which I would like to impose a delay?

Also, a question, does doing the pause() just block, or just delay, the fini() for other adapters.
Thanks!
Re: using pause() in adapter code
May 26, 2022 02:11AM
I do not understand. You should explain what you want to do, not how you want to do.

pause() is a MATLAB native command. Look at the MATLAB documentation.

The National Institute of Mental Health (NIMH) is part of the National Institutes of Health (NIH), a component of the U.S. Department of Health and Human Services.