All objects

Input properties all objects have


Defaults: don't show object in results

runExperiment outputs and saves experiment results. Optionally it also saves results to file at the end of each trial. In both cases results come in two variables: The first is a cell array that is designed to be easy to read as a table in MATLAB’s visual variable editor. The second variable compresses trial results into a numeric matrix or other arrays to facilitate extracting/plotting/analyzing with MATLAB functions.

Just about everything in results comes from objects in the experiment. For any object you to specify what to see using these two properties. If you leave both at default, the object doesn’t show in results.

report is an array of strings that are names of properties to see. These can include input properties which you can set when building the experiment. More commonly they are record properties which PsychBench uses to record information during the experiment. Common record properties to report are response, responseLatency, and other related information for response handler elements.

info attaches custom information to see for the object, most commonly test condition values associated with it. You can set info to a struct with any fields containing any values you want. Field names go to headings in the results table and field values go under those headings.


In this experiment each trial shows a picture randomly rotated between −30 … +30 deg. The subject responds by left/right arrow key press with whether the picture is rotated counterclockwise (negative angle) or clockwise (positive angle). Response is scored correct/incorrect. In results for the picture we ask to see the random value in input property rotation, and a rotation direction name (<cds>"ccw"<cds>, <cds>"cw"<cds>) and numeric code (−1 = left, +1 = right) based on it. For the response handler we ask to see record properties response, responseScore, responseLatency.

Note the key numbers for left/right arrow in this experiment script are for Windows. On Mac or Linux you would need to replace them with different key numbers. You can use Psychtoolbox KbShow to find key numbers on any system.


<cdkm>for<cdkm> r = 1:50
    pic = pictureObject;
    pic.fileName = <cdsm>"dog.jpg"<cdsm>;
    pic.rotation = randomNum(-30, 30);
    pic.start.t = 0;
    pic.end.duration = 0.5; = <cdsm>"rotation"<cdsm>;
    <cdkm>if<cdkm> pic.rotation < 0 = <cdsm>"ccw"<cdsm>; = -1;
    <cdkm>else<cdkm> = <cdsm>"cw"<cdsm>; = +1;

    recorder = keyPressObject;

    recorder.nn_listenKeys = [37 39];
    recorder.translateResponse = [
        37 -1
        39 +1
    recorder.scoreResponse = true;
    recorder.correctResponse =;
    recorder.start.endOf = <cdsm>"pic"<cdsm>;
    <cdcm>% keyPress ends on its own when it records a response<cdcm> = [<cdsm>"response" "responseScore" "responseLatency"<cdsm>];

    addTrial(pic, recorder);

[results, resultsMatrix] = runExperiment;
Note in each trial we set correct response for scoring to be whatever the rotation direction of the picture is. We use direction numbers ±1 for all of picture info, response, and correct response (see response handler property translateResponse).

The results table would look like this (first seven trials only). PsychBench automatically adds some information including results file name, date/time, screen measurements for visual angle degree units, and trial numbers and start times. The rest come from report and info.