MonkeyLogic

Behavioral Control in MATLAB

 



Running an Experiment



Basic Operation

A task is launched by clicking the Run button in the main menu. This button will become active once a conditions file has been loaded, the appropriate configuration parameters set, and a data file name has been entered. Note that if you enter the Subject Name field or the Experiment Name field and hit [enter], a standardized file name will be filled-in for you.

Clicking Run will launch the control screen (top screenshot, below) and will take control of the secondary screen (lower screenshot). The control screen displays symbols corresponding to the stimuli currently visible to the subject, as well as a ring corresponding to the eye or joystick target. These objects are to-scale. The eye or joystick trace will be updated in real-time as the subject moves. Between trials, the surrounding graphs (behavioral performance, reaction times, and event time-line) will be updated.

control screen
control screen

subject screen
subject's screen

Importantly, MATLAB MUST be running without JAVA enabled.  To disable java, run “matlab –nojvm” from the command prompt.  Applications other than this one instance of MATLAB should be shut-down, particularly if those applications may be running JAVA, such as web-browsers. Note specifically that other instances of MATLAB running in the background (especially those with JAVA enabled) will likely cause the system to behave erratically and will eventually crash MonkeyLogic.

In addition, screen-savers and power-saving options must be disabled so that they do not interfere with task execution.

A behavioral task will continue to execute until either the maximum trials parameter or the maximum blocks parameter is reached (both are specified in the task submenu of the main menu), unless the task is stopped manually (hitting [escape] and then [q] for quit).


Pausing the Task & On-Line Parameter Changes

The task can be paused between trials. To pause task execution, press [escape] any time during the trial or during the first half-second of the inter-trial interval. A menu will appear with some or all of the following options, depending on the experiment:

Key(s):
Action:
[space]
Resume task
[q]
Quit task
[b]
Change current block
[r]
Reset the recent behavior performance bar
[x]
Change behavioral-error handling
[e] or [j]
Re-calibrate eye-signal or joystick (if in-use)
[d]
Toggle eye-drift correction (if in-use)
[v]
Modify variables declared as editable

 


Predefined Hotkeys

Timing files allow for the definition of hotkeys via the Hotkey function. But certain hotkeys are already defined:

Hotkey:
Action:
[escape]
Pause task
[r]
Deliver 100 ms of reward
[-]
Reduce user-defined reward duration by 10 ms
[=]
Increase user-defined reward duration by 10 ms
[c]
Center the eye-position on the current fixation point

(It is recommended that you not define new hotkeys with these characters.)

 


Displaying a Custom Figure on the Control Screen

The area on the control-screen normally occupied by the reaction time histograms can be used instead for a plot designed by the user. Simply write an Matlab function that expects the TrialRecord structure as input; this structure contains a myriad of behavioral data that can be used for making the figure. From within this function, draw to the current axis (by directly issuing plot calls or other graphical commands without altering the current axis). Make certain to select this function as the "user plot" function near the bottom of the video panel towards the left side of the main menu.

If for some reason focus on the RT graph axis has been lost (e.g., opening and writing to another axis from within the user-plot function), it can be restored by calling:

axis(findobj('tag', 'rtgraph'));

Note that extremely complex figures can slow-down updates to the control-screen, and so could potentially steal time from behavioral sampling. This would be recognized as a drop in the "cycle rate" as displayed on the right side of the control-screen.

 


Remote Access: Controlling MonkeyLogic via the Web

If web updates are enabled, it is possible to send basic commands to MonkeyLogic via the update page. Inserting the keyword, "ML_CommandEntry" into the HTML template (as is done in the included mlwebsummary.html template) results in the following box appearing on that page at the specified location:

The instruction is a plain-language command for MonkeyLogic to execute. Authorization is the pass-code specified in the ftpinfo.txt file.

The currently-recognized commands are (case-insensitive):

pause | timeout | hold | wait
resume | continue | start
quit | stop | done
error string (e.g., repeat immediately | ignore | repeat delayed)
block n
iti n
maxblocks n
maxtrials n

Alternative options are shown in the same row, separated by a vertical line.

For remote-access commands to work, the directory specified in ftpinfo.txt must allow the execution of PHP scripts. In order to maintain security, system administrators may choose to allow only certain files to have create / write permissions. Specifically, a file called [computername]command.txt (all in small-caps) is created by the PHP script to store the user's remote command. The password is stored and verified locally on the computer running MonkeyLogic.

 



This site last updated: February, 2012
© 2008-2012