TrialRecord Structure

TrialRecord is a MATLAB struct that contains information about the trial history. It is used as an input argument to many functions, such as timing scripts, condition-selection functions, block-selection functions, block-change functions, user-plot functions and user-generated image functions. This structure has the following fields that are updated every trial.

Fields of TrialRecord Remarks
CurrentTrialNumber The currently executing trial number, consecutively numbered from the start of the session (scalar)
CurrentTrialWithinBlock The currently executing trial number, consecutively numbered from the start of the current block (scalar)
CurrentCondition The condition number of the current trial (scalar)
CurrentBlock The block number of the current trial (scalar)
CurrentBlockCount The total number of blocks played thus far, including the current one (scalar)
CurrentConditionInfo A struct created from the "info" column of the conditions file
CurrentConditionStimulusInfo Information about the stimuli used in the current trial (cell array, one cell per TaskObject)
ConditionsPlayed The list of conditions played since the start of the session (a vector of length (CurrentTrialNumber - 1))
ConditionsThisBlock The list of conditions which are available for selection from within the current block (vector of variable length)
BlocksPlayed The list of blocks played since the start of the session (a vector of length (CurrentTrialNumber - 1))
BlockCount The number of blocks played, as of any given trial thus far (a vector of length (CurrentTrialNumber - 1))
BlockOrder The order of blocks played thus far, including the current block (vector)
BlocksSelected The list of blocks available, as selected from the main menu (vector)
TrialErrors The list of behavioral errors for every trial played so far (a vector of length (CurrentTrialNumber - 1)). See also the trialerror function.
ReactionTimes The list of reaction times for every trial played so far (a vector of length (CurrentTrialNumber - 1))
LastTrialAnalogData A structure containing the fields EyeSignal and Joystick, with the x- and y-vectors of the last trial's analog signals
LastTrialCodes A structure containing the fields CodeNumbers and CodeTimes, containing vectors corresponding to each
Editable A struct of "editable" variables defined in the timing script
DataFile Name of the current data file

While the above fields are automatically updated by NIMH ML and not editable, there are a few other user-editable fields for task flow control and screen updates.

Fields of TrialRecord Default Value Remarks
Pause false If true, the task pauses after the current trial.
Quit false If true, the task quits after the current trial.
DrawTimeLine true If false, the Time Line panel of the control screen is NOT updated after each trial. This option is useful to suppress the output, when there are too many event codes to draw.
MarkSkippedFrames false If true, eventcode 13 is marked in case of frame skipping.
DiscardSkippedFrames true If false, skipped frames are presented again. This does not mean that NIMH ML keeps the contents of skipped frames. NIMH ML simply redraws the screen without increasing the frame number.
User struct Users can create temporary variables in this field that they want to pass to other functions across trials.

In the original ML, users could add custom fields to TrialRecord to pass variables around. In NIMH ML, such a trick does not work, because TrialRecord is a class object, not a struct. If you need custom fields, use TrialRecord.User instead.

TrialRecord.var1 = 200; % fine in the original ML, but not in NIMH ML TrialRecord.User.var1 = 200; % good with NIMH ML

Note that the fields you create under TrialRecord.User are NOT automatically saved to the data file. You should use the bhv_variable function to keep the records of them.

The National Institute of Mental Health (NIMH) is part of the National Institutes of Health (NIH), a component of the U.S. Department of Health and Human Services.