Welcome! Log In Create A New Profile

Advanced

Initial position of the cursor

Posted by Song_Moore 
Initial position of the cursor
August 14, 2019 07:21PM
Hi, I am trying to set up the starting position of the cursor for joystick so that it can show up randomly each time when a new condition is run. Is there a way I can do this? Thank you.
Re: Initial position of the cursor
August 14, 2019 07:36PM
Have you checked the "task\runtime v1\8 customized calibration" example? For joystick, you can use JoyCal or Joy2Cal.

new_origin = [3 3];
JoyCal.custom_calfunc(@translate_joy);
...
...
...
function xy = translate_joy(xy)
    n = size(xy,1);
    xy = xy + repmat(new_origin,n,1);
end

I just wrote the above code off the top of my head, so compare it with the "8 customized calibration" example and make any necessary change. You can perturb the calibration in any way you want.
Re: Initial position of the cursor
August 15, 2019 01:32PM
Hi Jaewon,

Thank you so much for your help, I updated my script and it works pretty well!
I did saw the customized calibration file but just had a hard time to make cursor start moving after setting it up.

I have another question want to ask:

Is there a way I can updated my Target picture to a different picture? For example, after the delay period, two images are presented on both sides of the screen (blue circle and red circle), and when the subject operates the joystick to chose the blue circle, which is target here, I can update a green circle picture to replace the blue circle immediately to indicate success before the picture disappears.

-Moore
Re: Initial position of the cursor
August 15, 2019 01:45PM
Create two circles (blue and green). Then, when the blue circle is chosen, turn it off and turn on the green one.
Re: Initial position of the cursor
August 15, 2019 02:47PM
Found the way to do that, thank you!

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.