Type | Syntax | Remarks |
Fixation point1 | fix(Xdeg, Ydeg) | • Xdeg and Ydeg: XY positions in degrees2 |
Static image1 |
pic(filename, Xdeg, Ydeg) pic(filename, Xdeg, Ydeg, colorkey) pic(filename, Xdeg, Ydeg, Wpx, Hpx) pic(filename, Xdeg, Ydeg, Wpx, Hpx, colorkey) |
• filename: BMP, GIF, JPG, TIF or PNG • Xdeg and Ydeg: in degrees2 • colorkey: a color [R G B] which will be treated as transparent • Wpx and Hpx: optional resizing parameters (width and height in pixels) |
Movie1 |
mov(filename, Xdeg, Ydeg) mov(filename, Xdeg, Ydeg, looping) |
• filename: MP4, AVI, MPG or animated GIF • Xdeg and Ydeg: in degrees2 • looping: 0 (not repeat) or 1 (repeat) • See the remark below for compatibility with the original ML6. |
Circle1 | crc(radius, RGB, fill, Xdeg, Ydeg) |
• radius: in degrees • RGB: a triplet [R G B] with values 0-1 • fill: 0 (outline) or 1 (filled) • Xdeg and Ydeg: in degrees2 |
Square1 | sqr(size, RGB, fill, Xdeg, Ydeg) |
• size: 1 element (square) or 2 (rectangle) in degrees • RGB: a triplet [R G B] with values 0-1 • fill: 0 (outline) or 1 (filled) • Xdeg and Ydeg: in degrees2 |
Sound |
snd(filename) snd(sin, duration, frequency) |
• filename: WAV, MP3, M4A, AAC, OGG or MAT3 • sin is to be typed literally. • duration: in seconds • frequency: in Hertz |
Stimulation |
stm(port, datasource) stm(port, datasource, retriggerable) |
• port: Stimulation # on the main menu I/O panel • datasource: WAV, MP3, M4A, AAC, OGG or MAT3 • retriggerable: 0 (can be triggered only once) or 1 (multiple times)4 |
TTL pulse | ttl(port) | • port: TTL # on the main menu I/O panel |
User-generated Pic or Mov1 |
gen(function_name) gen(function_name, Xdeg, Ydeg) |
• function_name: a user-provided MATLAB function5 • Xdeg and Ydeg: in degrees2 |
For visual stimuli, an object with a smaller number will layer atop those with larger numbers. For example, when TaskObject#1 and TaskObject#2 are presented at the same location, TaskObject#1 will appear in front of TaskObject#2.
The center of the screen is the origin ([0 0]). The positive direction is the right of the origin for x axis and above the origin for y axis.
The MAT files must contain two variables, “y” and “fs”, for waveform and frequency, respectively.
When the “retriggerable” flag of an STM object is 1, stopping the stimulation will take a slightly longer time, to reload the waveform.
The GEN user function can take one of the following prototypes.
imdata = gen_func(TrialRecord);
imdata = gen_func(TrialRecord, MLConfig);
[imdata, info] = gen_func(___);
[imdata, Xdeg, Ydeg] = gen_func(___);
[imdata, Xdeg, Ydeg, info] = gen_func(___);
The GEN function takes the TrialRecord structure as input and can optionally take the MLConfig structure as the second argument.
imdata can be a filename or a matrix of one of the following dimensions.
Y-by-X: gray-scale image
Y-by-X-by-3: RGB image
Y-by-X-by-4: ARGB image (A: alpha channel)
Y-by-X-by-3-by-N: RGB movie (N: # of frames)
Y-by-X-by-4-by-N: ARGB movie (A: alpha channel, N: # of frames)
If Xdeg and Ydeg are not given in the conditions file, they can be provided from the GEN function. They are both 0 by default.
Users can deliver extra information about the GEN stimulus to the timing script or other user functions by adding new fields to the info structure. There are a few reserved field names.
info.Colorkey (for images only): a 1-by-3 RGB color, [R G B], which should be treated as transparent
info.Looping (for movies only): true or false; if true, the movie is repeated when the last frame is reached.
info.TimePerFrame (for matrix-based movies only): the interval between movie frames; in milliseconds
info.FrameByFrame (for file-based movies only): true or false; if true, the movie is played as in the original MonkeyLogic (repeatable and manipulatable frame by frame)
The info structure can be accessed in the timing script or other user functions this way.
StimulusInfo(TaskObject#).MoreInfo % in timing script
TrialRecord.CurrentConditionStimulusInfo(TaskObject#).MoreInfo % via TrialRecord structure
The original ML processes movies frame by frame without respecting their frame rates. This makes the speed of movies dependent on the refresh rate. To play movies in the same way as the original MonkeyLogic does, use GEN, instead of MOV, and assign 1 to info.FrameByFrame.
gen(moviefile,0,0) % in the conditions file
function [imdata,info] = moviefile(TrialRecord,MLConfig) % gen script
imdata = 'moviefile.avi' ;
info.FrameByFrame = 1;
end