General Task Design
Timing scripts are the lines of code which actually determine when and how things occur during a trial of the task (example). A timing script is run once for each trial and determines all of the events and contingencies possible during that trial. Timing scripts generally operate independently of the specific stimuli used in a particular trial; they refer to these stimuli only by the column in which they appear in the conditions file. This allows a single timing file to be used across many different conditions which share identical temporal structure, but differ in their specific stimuli.
The particular condition being run is determined by the options selected in the main menu before a timing script is called. The conditions file determines which timing script is executed once a condition has been selected (different conditions can be associated with different timing scripts).
The diagram above shows the basic sequence of a standard two-alternative, forced-choice "delayed-match-to-sample" task (see also Example Task), in which the subject is presented with one visual stimulus and must remember it over a short delay in order to select it from among one or more distractors later. Much more complex tasks are possible in MonkeyLogic; however this very simple one allows a depiction of the basic process of constructing a task's timing script. In this particular implementation, the subject's eye movements will be monitored, and he or she must fixate on a central dot throughout the entire trial. When the choices are presented near the end of the trial, one is selected simply by saccading to it (looking at it).
This diagram shows the bare-bones steps needed to construct the example delayed-match-to-sample ("DMS") task. The functions used for each step are shown in italics. Toggleobject is the primary function for presenting visual stimuli, turning on TTLs or analog outputs, etc. The eyejoytrack function is used to determine if the eye position (or joystick position, see below for function details) is where it is expected to be. The output of this function therefore determines whether to continue through the task or abort the trial (by setting the "trialerror" to the desired value and issuing a "return" statement).
In addition to these basic elements, event-markers should be used to time-stamp behaviorally-relevant events; these allow post-hoc alignment of neural data with the appropriate triggers. An event-marker is simply a number which corresponds to a descriptive string explaining the time-stamped event.
A timing script should assign a trial error value (using the TrialError function) to reflect the subject's performance on that trial.
At the end of each trial , the value of the variable "rt" is used to update the reaction time bar graph in the control screen. This can be returned from the eyejoytrack function or it can be assigned manually.
Timing scripts can, for the most part, use any valid MATLAB command and should be written as any standard MATLAB script. There are a few important guidelines which must be followed, however:
Do not declare the script as a function.
Any return command should appear separately (on its own line).
A timing script can use almost any valid MATLAB expression, and in addition can use any of these trial-specific functions:
To see details for each of the commands above, please go to the commands section of this site.