Task flow control

On Error

This menu determines how to handle error trials.

  • ignore disregards errors when the next condition is selected.
  • repeat immediately makes the same condition played repeatedly until the trial succeeds (i.e., trialerror(0) is set in the timing file).
  • repeat delayed throws error trials back into the queue, but at a later point in the block.
    • This option is effective only when the condition selection option is random without replacement.
    • If possible, the next condition is selected first among the remaining trials and then the error trial is added back to the queue so that the same condition may not be repeated immediately.

Conditions

This menu determines the method to select the next condition.

  • random with replacement makes the next condition selected randomly, without regard to which conditions have already been chosen.
  • random without replacement randomly chooses the next condition but excludes those trials already used.
  • increasing and decreasing simply choose the next condition in numerical order, rising or falling as appropriate. The condition numbers will "wrap" when the end or beginning of the condition list is reached.
  • user-defined allows a MATLAB function ("condition selection function") to determine how conditions are selected. This is useful, for example, to enact particular rules about how certain conditions should follow others or how the selection of certain conditions precludes others.
    • The condition selection function should expect TrialRecord and optionally MLConfig as input and return a single scalar, the condition to-be-run.
    • function cond_no = cond_selection(TrialRecord) % one-argument version function cond_no = cond_selection(TrialRecord, MLConfig) % two-argument version
    • The condition selection function is executed before each trial begins.
    • TrialRecord.CurrentTrialNumber will be 1, when the function is called for the 1st trial; 2 for the 2nd trial and so on.
    • If the function returns a value of "-1", the current block ends and a new block will begin; then, the function will be called again immediately for the new block.

Blocks

This menu is identical in logic to the Conditions menu above, except that it is used to choose the next block.

  • See Conditions above, for random with replacement, random without replacement, increasing and decreasing.
  • user-defined requires a MATLAB function ("block selection function") that takes TrialRecord and optionally MLConfig as input and returns a new block number.
    • function block_no = block_selection(TrialRecord) % one-argument version function block_no = block_selection(TrialRecord, MLConfig) % two-argument version
    • The block selection function is evaluated only when the new-block flag is set (e.g., before the very 1st trial, after a block is completed, etc.) and before a trial begins.
    • However, if the block selection function is also the block change function (see below), the function is executed every trial and at the end of a trial (also at the beginning of the very 1st trial).
    • If the block selection function returns a value of "-1", the task will be terminated.
  • Block change function, if specified, is called after every trial to determine whether a new block should be initiated.
    • The block change function has the same definition as the condition selection function or block selection function above and should return a value of "0" to continue the current block or "1" to change it.
    • If the Blocks option is user-defined and the block change function is the same file as the block selection function, the function not simply returns a block switch flag but actually determines the next block to be run (e.g., return "3" to switch to the third block). This feature allows one m-file to control both when a block switches and which block is selected next.
    • If this function returns -1, the task will end.

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.