This function assigns string labels to numeric behavioral codes.
Syntax:
Example:
This function stores variables to the data file.
Syntax:
Example:
This function displays user texts on the control screen.
Syntax:
Input arguments:
Example:
Remarks:
This function registers variables to the edit menu.
Syntax:
Input arguments:
Example:
Remarks:
var1 = 1000;
editable(
var1 = 1000;
var2 = var1;
editable(
This function pauses the task after the current trial.
Syntax:
This function marks the current time with eventcodes. The eventcodes can also be sent to external devices, if Behavioral Codes and Strobe Bit are assigned on the main menu I/O panel.
To more accurately mark onset times of stimuli or rewards, use the eventmarker option of toggleobject and goodmonkey or the eventcode argument of run_scene, instead of this function.
Syntax:
Example:
These functions return the current eye or joystick position. The return values are in degrees.
Syntax:
This function translates the current eye calibration grid to a new origin.
Syntax:
Input arguments:
Example:
Remarks:
- [0 0], if there is no visual object on the screen
- The position of the visual object, if there is only one on the screen
- The position of the visual object closest to the current eye position, if there are multiple objects on the screen
This function returns the most recently acquired analog samples of the specified signal.
Syntax:
Input arguments:
Return values:
Example:
Remarks:
Syntax:
Example:
Syntax:
Example:
This function waits for a key input.
Syntax:
Remarks:
This function initiates timed reward pulses to reward devices.
Syntax:
Input arguments:
Example:
This function defines a key macro.
Syntax:
Input arguments:
Example:
Syntax:
Input arguments:
Remarks:
Syntax:
Return values:
This function returns the current mouse position and the button/key state.
Syntax:
Return values:
Remarks:
This function moves graphic objects to new locations.
Syntax:
Input arguments:
Example:
This function changes the size of graphic objects to the given scale.
Syntax:
Input arguments:
Example:
This function rotates graphic objects.
Syntax:
Input arguments:
Example:
rewind_sound is the same as rewind_movie except that it works for SND objects, instead of MOVs.
Syntax:
Input arguments:
Example:
This function changes the background color of the subject screen.
Syntax:
Input arguments:
Example:
Remarks:
This function overwrites the default inter-trial interval set on the main menu.
Syntax:
Remarks:
This function turns on and off the joystick cursor. By default, it is off. showcursor2 is for the 2nd joystick.
Syntax:
Input arguments:
Example:
Remarks:
This function returns xy coordinates of the places that are currently being touched.
Syntax:
Return values:
Remarks:
This function records the error code of the current trial to the TrialRecord structure.
Syntax:
Example:
Input arguments:
Remarks:
This function returns the time elapsed from the trial start in milliseconds.
Syntax:
This function displays user texts on the control screen GUI at the end of a trial.
Syntax:
Remarks:
This function monitors behavioral signal inputs.
Syntax:
Input arguments:
Signal type | Acquisition | Hold | Inverse acquisition |
eye | 'acquirefix' | 'holdfix' | |
eye2 | 'acquirefix2' | 'holdfix2' | |
joystick | 'acquiretarget' | 'holdtarget' | |
joystick2 | 'acquiretarget2' | 'holdtarget2' | |
touch | 'touchtarget' | 'releasetarget' | '~touchtarget' |
button | 'acquiretouch' | 'holdtouch' | |
function | 'acquirefunc' | 'holdfunc' |
Remarks:
ontarget = eyejoytrack(
ontarget = eyejoytrack(
[ontarget, rt] = eyejoytrack(
[ontarget, rt] = eyejoytrack(
[ontarget, rt] = eyejoytrack(
ontarget = eyejoytrack(
eye fixation OFF & button NOT TOUCHED ⇒ eyejoytrack returns immediately & ontarget will be [0 0].
eye fixation ON & button NOT TOUCHED ⇒ eyejoytrack returns immediately & ontarget will be [1 0].
eye fixation OFF & button TOUCHED ⇒ eyejoytrack returns after 2 sec & ontarget will be [0 1].
eye fixation ON & button TOUCHED ⇒ eyejoytrack returns immediately & ontarget will be [1 1].
This function marks the time with eventcodes when particular frames are presented.
Syntax:
Input arguments:
This function rearranges the order of movie frames.
Syntax:
Input arguments:
This function translates a graphic object through a given path.
Syntax:
Remarks:
This function turns on and off TaskObjects.
Syntax:
Input arguments:
Return values:
Example:
Remarks:
This function collects the information of the adapter chain for the offline trial replay.
Syntax:
Input arguments:
Example:
Remarks:
This function runs the adapter chain.
Syntax:
Input arguments:
Return values:
Example:
Remarks:
Users do not need to create tracker objects. They are pre-defined with reserved names in the timing script: eye_, eye2_, joy_, joy2_, touch_, button_, mouse_ and null_.
Success Condition:
Stop Condition:
Tracker Properties:
All trackers have common properties like the following.
Every adapter in a chain can access the above objects via its Tracker property, which is a convenient way to get the information about screens, data sources and TaskObjects from the inside of the adapter.
The trackers also have the following data fields for different types.
eye_, eye2_ | joy_, joy2_ | touch_ | button_ | mouse_ | null_ |
XYData LastSamplePosition |
XYData LastSamplePosition |
XYData LastSamplePosition |
ClickData LastSamplePosition |
XYData ClickData KeyInput LastSamplePosition |
These fields are continuously updated with data acquired during the previous frame (or data acquired before the scene start, if it is the very first frame of the scene). So, at a refresh rate of 60 Hz, about 16-17 samples are kept in each of them (except LastSamplePosition) from moment to moment.
Tracker Methods:
button_.threshold(button#, buttonThreshold);
button_.invert(button#);
button_.label(button#, str);
When a button is inverted with button_.invert(), the input from the button is saved in the data file as inverted. If you want to change the polarity of a button but not the saved values, use NotAdapter (see its usage example for details).
mouse_.Cursor = true;
mouse_.Simulation = true;
mouse_.setCursorPos([xdeg ydeg]);
If you want to show the mouse cursor for a particular scene, there is no need to use the mouse_.Cursor property. The cursor shows up automatically on the subject screen, if the scene includes the MouseTracker (mouse_). That property is for removing the cursor completely from both screens.
This adapter checks whether the position of a XY signal (eye_, joy_, and touch_) is within or outside the threshold window.
Success Condition:
Stop Condition:
Input properties:
Output properties:
Example 1:
Example 2:
Remarks:
This adapter creates a combination of SingleTarget and WaitThenHold for each target location, to check which target captures the XY signal.
Success Condition:
Stop Condition:
Input properties:
Output properties:
Example:
Remarks:
This adapter checks if the Success state of the child adapter becomes true within WaitTime and stays true for HoldTime. It can be used to test if eye fixation or touch is acquired and maintained.
Success Condition:
Stop Condition:
Input properties:
Output properties:
Example:
Remarks:
This adapter is similar to WaitThenHold. The difference is that FreeThenHold allows breaking fixation and trying again, as long as MaxTime is not reached.
Success Condition:
Stop Condition:
Input properties:
Output properties:
Example:
Remarks:
This adapter checks to see if the Success state of the child adapter stays true for HoldTime. It allows brief state changes (i.e., to be false), as long as the change is shorter than BreakTime. This is useful to test if the previously acquired eye fixation is maintained while allowing for temporary breaks due to blinking.
Success Condition:
Stop Condition:
Input properties:
Example:
This adapter sets a complementary window around the target(s) to detect touches outside the window.
Success Condition:
Stop Condition:
Input properties:
Example:
This adapter checks if the specified button was pressed.
Success Condition:
Stop Condition:
Input properties:
Output properties:
Example:
Remarks:
button_.invert(1);
button_.threshold(button#, buttonThreshold);
This adapter counts the number of TTL pulses (or # of button presses).
Success Condition:
Stop Condition:
Input properties:
Output properties:
Example:
Remarks:
This adapter detects when the child adapter's Success becomes true for the first time.
Success Condition:
Stop Condition:
Output properties:
Example:
Remarks:
This adapter checks the state of a key. Key code(s) to monitor must be set in the [Other device settings] menu first.
Success Condition:
Stop Condition:
Input properties:
Output properties:
Example:
Remarks:
This adapter measures a duration.
Success Condition:
Stop Condition:
Input properties:
Example:
Remarks:
This adapter measures a duration in terms of the number of frames.
Success Condition:
Stop Condition:
Input properties:
Example:
Remarks:
This adapter is used to delay the onset of stimuli that are created with adapters.
Success Condition:
Stop Condition:
Input properties:
Example:
Remarks:
Normally the photodiode trigger is toggled only at the beginning of a scene, but this adapter makes it toggled every frame during the scene.
Success Condition:
Stop Condition:
Example:
Remarks:
This adapter stamps eventcode(s) when a particular frame is presented.
Success Condition:
Stop Condition:
Input properties:
Example:
Remarks:
This adapter sends out pre-set eventcodes when the state of a child adapter property changes.
Success Condition:
Stop Condition:
Input properties:
Example:
Remarks:
This adapter displays pre-set messages depending on the state of a child adapter property.
Success Condition:
Stop Condition:
Input properties:
Example:
This adapter displays the value of a child adapter property on the dashboard during run_scene().
Success Condition:
Stop Condition:
Input properties:
Example:
This adapter draws a trace of a selected General Input on the control screen for a monitoring purpose.
Success Condition:
Stop Condition:
Input properties:
Example:
This adapter displays images captured by webcams on the control screen.
Success Condition:
Stop Condition:
Input properties:
Example:
This adapter draws a square/rectangle.
Success Condition:
Stop Condition:
Input properties:
Example:
Remarks:
This adapter is the same as BoxGraphic except that this one draws a circle/oval.
Remarks:
This adapter draws a filled arc.
Success Condition:
Stop Condition:
Input properties:
Example:
Remarks:
This adapter draws a user-defined polygon.
Success Condition:
Stop Condition:
Input properties:
Example:
Remarks:
This adapter draws a user string.
Success Condition:
Stop Condition:
Input properties:
Example:
Remarks:
This adapter presents static images.
Success Condition:
Stop Condition:
Input properties:
Output properties:
Example 1:
Example 2:
Remarks:
This adapter presents movies.
Success Condition:
Stop Condition:
Input properties:
Output properties:
Example 1:
Example 2:
Example 3:
Remarks:
This adapter draws a sine grating.
Success Condition:
Stop Condition:
Input properties:
Output properties:
Example:
Remarks:
This adapter draws a random dot motion stimulus.
Success Condition:
Stop Condition:
Input properties:
Example:
Remarks:
This adapter presents multiple image sets in series.
Success Condition:
Stop Condition:
Input properties:
Output properties:
Example:
Remarks:
This adapter changes properties of a graphic object over the course of the scene.
Success Condition:
Stop Condition:
Input properties:
Methods:
Example 1:
Example 2:
This adapter presents audio sounds.
Success Condition:
Stop Condition:
Input properties:
Example 1:
Example 2:
Remarks:
This adapter delivers electrical stimulation via analog output.
Success Condition:
Stop Condition:
Input properties:
Example:
Remarks:
This adapter sends out a TTL pulse via a digital line.
Success Condition:
Stop Condition:
Input properties:
Example:
This adapter continues the scene while all child adapter chains continue.
Success Condition:
Stop Condition:
Methods:
This adapter continues the scene if any of the child adapter chains continues.
Success Condition:
Stop Condition:
Methods:
This adapter combines multiple adapter chains and finishes the scene when all the chains succeed.
Success Condition:
Stop Condition:
Methods:
Example:
Remarks:
This adapter combines multiple adapter chains and finishes the scene when any one of them succeeds.
Success Condition:
Stop Condition:
Methods:
Example:
Remarks:
This adapter negates the Success state of the child adapter.
Success Condition:
Stop Condition:
Example:
This adapter runs multiple adapter chains simultaneously but watches only the first chain added. This adapter is useful to add extra graphics.
Success Condition:
Stop Condition:
Methods:
Example:
This adapter runs multiple chains sequentially.
Success Condition:
Stop Condition:
Input properties:
Output properties:
Methods:
Example:
Remarks:
This adapter delivers rewards at given intervals while its child adapter's Success state is true.
Success Condition:
Stop Condition:
Input properties:
Example:
This adapter translates the position of a TaskObject along the given path.
Success Condition:
Stop Condition:
Input properties:
Output properties:
Methods:
Example 1:
Example 2:
This adapter translates the position of a TaskObject along the path defined by the direction and speed parameters and checks if the XY signal remains inside the fixation threshold.
Success Condition:
Stop Condition:
Input properties:
Output properties:
Example:
This adapter counts how long a XY signal stays in the threshold window.
Success Condition:
Stop Condition:
Output properties:
Example:
Remarks:
This adapter tracks the selected graphic stimulus until it is released from the previous hold. If the released location is close to the destination, the stimulus is pulled to the destination like a magnet. Otherwise, it goes back to the initial location.
Success Condition:
Stop Condition:
Input properties:
Output properties:
Methods:
Example:
Remarks:
This adapter cancels out trembles in an XY signal so that graphic stimuli can be presented in the same location relative to the current XY position.
Success Condition:
Stop Condition:
Input properties:
Example:
This function reads data files and shows a performance summary.
These functions convert BHV2 files to MAT or BHVZ (zipped BHV2) files, respectively. The converted files are still readable with mlread.
Syntax:
This function combines trial-by-trial analog data into one large matrix and adjusts all timestamps accordingly, as if they are recorded in one single trial. It is useful when reading data files that are continuously recorded through inter-trial intervals. This command does not process webcams and high frequency channels, since loading them all at once can cause an out-of-memory error.
Syntax:
This function extracts saved stimuli from the data file.
Syntax:
This function reads webcam videos from the data file and saves them as MP4. It is possible to strip off the videos completely from the data file by setting the delete_video option true. The original files will be kept in the "orig" folder.
Syntax:
This function attaches exported webcam videos (MP4s) back to the data file. If the video files are not in the same folder as the data file, a path to the videos can be provided.
Syntax:
This function opens a trial-replay and video-exporting dialog.
This function provides a unified read interface for all the data formats (*.bhv2; *.bhvz; *.h5; *.mat). It returns trial-by-trial data in a 1-by-n array of structures.
Syntax:
This function reads signals recorded at unconventional sample rates (i.e., not 1 kHz), such as High Frequency, Voice and Webcam. These data usually have a large size, so loading them up all at once with mlread or mlconcatenate may cause an out-of-memory error. Use this function instead.
Syntax: