This function assigns string labels to numeric behavioral codes.
Syntax:
Example:
This function stores the current values of variables to the data file.
Syntax:
Example:
Remarks:
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' ); % okay
var1 = 1000;
var2 = var1; % initialized with another variable
editable('var2' ); % error!!!
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 TaskObject on the screen
- The position of the visual TaskObject, if there is only one object on the screen
- The position of the visual TaskObject 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:
This function returns the durations of MOV and SND objects.
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:
This function includes other script files into the current script.
Syntax:
Example:
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:
This function moves the playback positions of MOV and SND TaskObjects.
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 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' |
Example 1: single tracking
Example 2: multi-tracking
Remarks:
ontarget = eyejoytrack('acquirefix' , [2 3 5], 3, 5000); % eyejoytrack will return 3, if the eye
% fixates on TaskObject#5, because TaskObject#5 is the third object in the list.
ontarget = eyejoytrack('acquiretouch' , 2, 5, 500); % Button #2; input voltage should be larger
% than 5V when the button is pushed.
ontarget = eyejoytrack('holdtouch' , 1, [], 500); % Button #1; use the default threshold.
ontarget = eyejoytrack('acquirefunc' , @function_handle, input_args, duration);
ontarget = eyejoytrack('acquirefix' , 1, 3, 'holdtouch' , 1, [], 2000); % track for 2 sec
Eye fixation | Button state | eyejoytrack returns | ontarget |
not acquired | released | immediately on release | [0 0] |
not acquired | held down | after 2 sec | [0 1] |
acquired | released | immediately on fixation/release | [1 0] |
acquired | held down | immediately on fixation | [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 the joystick cursor on the subject screen. By default, it is off. showcursor2 is for the 2nd joystick.
Syntax:
Input arguments:
Example:
Remarks:
This function turns on and off TaskObjects.
Syntax:
Input arguments:
Return values:
Example:
Remarks:
% Example 1
toggleobject(1, 'status' , 'off' ); % TaskObject#1 OFF
toggleobject(2, 'status' , 'on' ); % TaskObject#2 ON
toggleobject([1 2], 'status' , 'on' ); % Both TaskObject#1 and #2 are ON
% Example 2
toggleobject(1, 'status' , 'off' );
toggleobject(2, 'status' , 'on' );
toggleobject([1 2]); % TaskObject#1 ON; TaskObject#2 OFF
% Example 1
toggleobject(1);
toggleobject(2); % TaskObject#2 is turned on one frame later than TaskObject#1
% Example 2
toggleobject([1 2]); % TaskObject#1 & #2 are turned on simultaneously
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.
The joystick cursors can be modified in the timing file via the following properties. Use joy2_ for the second joystick.
Tracker Methods:
Calling joy_.showcursor(false) one more time while the cursor is hidden removes the cursor from the control screen as well.
When a button is inverted with button_.invert(), the input from the button is saved as inverted in the data file. If you want to change the polarity of a button but not the saved values, use NotAdapter (see its usage example for details).
This adapter tells whether the position of a XY tracker (eye_, joy_, touch_ and mouse_) is within or outside the threshold window.
Success Condition:
Stop Condition:
Input properties:
Output properties:
Methods:
Example 1:
Example 2:
Example 3:
Remarks:
This adapter monitors the capture of an XY tracker for multiple targets.
Success Condition:
Stop Condition:
Input properties:
Output properties:
Methods:
Example 1:
Example 2:
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 WaitTime is not expired.
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 XY input outside the window.
Success Condition:
Stop Condition:
Input properties:
Example:
Remarks:
This adapter checks if the XY tracker enters a specified area during the scene. Since eye trackers typically send out some extreme values for blinks, it can be used to detect the blinks by setting a forbidden area around the extreme coordinates.
Success Condition:
Stop Condition:
Input properties:
Output properties:
Example:
Remarks:
This adapter checks if the specified button was pressed.
Success Condition:
Stop Condition:
Input properties:
Output properties:
Example:
Remarks:
btn.Button = 1;
btn.TouchMode = true; % After assigning Button
button_.invert(1); % Invert Button#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 draws a trace of a selected signal (General Input, High Frequency and Voice) on the control screen for a monitoring purpose.
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 displays images captured by webcams on the screen.
Success Condition:
Stop Condition:
Input properties:
Example:
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 draws pre-set graphics depending on the state of a child adapter property.
Success Condition:
Stop Condition:
Input properties:
Methods:
Example:
Normally the photodiode trigger is toggled only at the beginning of a scene, but this adapter makes it toggled every frame during the scene (Example 1) or when an eventcode is issued (Example 2).
Success Condition:
Stop Condition:
Input properties:
Example 1:
Example 2:
Remarks:
This adapter draws a square/rectangle.
Success Condition:
Stop Condition:
Input properties:
Example 1:
Example 2:
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 1:
Example 2:
Remarks:
This adapter draws a user-defined polygon.
Success Condition:
Stop Condition:
Input properties:
Example 1:
Example 2:
Remarks:
This adapter draws a user string.
Success Condition:
Stop Condition:
Input properties:
Output properties:
Example 1:
Example 2:
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:
Example 1:
Example 2:
This adapter draws a random dot motion stimulus.
Success Condition:
Stop Condition:
Input properties:
Example 1:
Example 2:
Remarks:
This adapter combines various graphic adapters into one.
Success Condition:
Stop Condition:
Input properties:
Methods:
Example:
This adapter translates the position of a graphic object along the given path.
Success Condition:
Stop Condition:
Input properties:
Output properties:
Methods:
Example 1:
Example 2:
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:
Output properties:
Methods:
Example 1:
Example 2:
Remarks:
This adapter changes the background color of the subject screen according to the given schedule.
Success Condition:
Stop Condition:
Input properties:
Output properties:
Example:
Remarks:
This adapter presents audio sounds.
Success Condition:
Stop Condition:
Input properties:
Output properties:
Example 1: Audio filename
Example 2: Function string
Example 3: [duration frequency]
Remarks:
This adapter delivers electrical stimulation via analog output.
Success Condition:
Stop Condition:
Input properties:
Example:
Remarks:
This adapter sends out TTL pulses via digital lines.
Success Condition:
Stop Condition:
Input properties:
Example 1:
Example 2:
Remarks:
This adapter combines multiple adapter chains and continues the scene while all the child chains continue.
Success Condition:
Stop Condition:
Methods:
Example:
Remarks:
This adapter combines multiple adapter chains and continues the scene if any of the child chains continues.
Success Condition:
Stop Condition:
Methods:
Example:
Remarks:
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 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 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 counts how long a XY tracker stays in the threshold window.
Success Condition:
Stop Condition:
Output properties:
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:
Remarks:
This function reads data files and shows a performance summary.
This function rewrites NIMH ML data files (*.bhv2, *.bhvz, *.h5, *.mat) in a different format.
Syntax:
Remarks:
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 may cause an out-of-memory error. For that reason, mlread and mlconcatenate do not load them. Use this function instead.
Syntax: