Welcome! Log In Create A New Profile

Advanced

Use the keyboard to quickly change parameters

Posted by reegel 
Use the keyboard to quickly change parameters
November 22, 2020 03:23AM
Hi Jaewon,

Is it possible to change custom parameter values by using the keyboard without calling the editable provided by NIMH ML?


Thanks!
Re: Use the keyboard to quickly change parameters
November 22, 2020 10:37AM
Re: Use the keyboard to quickly change parameters
November 26, 2020 03:54AM
Thanks for your reply Jaewon.

I noticed the hotkey function, it works perfect in case of the reward function as you exampled.

However, it didn't change the value of my customized variables as the editable did.

below are the examples showing how i tried
%%%
hotkey('r', 'my_variable=1;');
hotkey('t', 'my_variable=0;');
%%%

If i print the my_variable, the output was correct (1 after I press 'r' and 0 after I press 't' );

but it didn't work into a following if condition.

for example
%%%
if my_variable===1
...
else
...
end
%%%


Could you show me an example of how to change the value of our customized variable?(as the editable did)

Thank you very much!
Re: Use the keyboard to quickly change parameters
November 26, 2020 02:50PM
I don't understand what you are trying to do. Did you make the if statement called by the hotkey or not? If you just put it in the timing script, it is executed when it is executed.

If you want to edit as the editable does, use the editable.
Re: Use the keyboard to quickly change parameters
November 26, 2020 08:29PM
Hi Jaewon,

Yes, i want to edit as my customized variable (my_variable in the above case) as editable does using the hotkey.

and no, I didn't make the if statement called by the hotkey; i only tried to change the value of a variable, which was imbedded into a following if statement in the timing script.



Using the editable will trigger a pop-up window, and an inevitable longer inter-trial-interval.

So i want to change the value by simply pressing some keys.

Is it possible?
Re: Use the keyboard to quickly change parameters
November 29, 2020 10:57PM
The hotkey is executed asynchronously to the rest of the timing script. Putting the if statement after the hotkey function does not make it executed by the key. Provided that the if statement is already evaluated in the current trial, you will have to wait until the next trial for the new value to make an effect.

Anything is possible if you program it right.
Re: Use the keyboard to quickly change parameters
November 30, 2020 06:11AM
Got it! Thanks Jaewon!

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.