All objects

Input properties all objects have

report
info

Defaults: don't show object in results

runExperiment outputs and saves experiment results in two variables. The first is a cell array that is designed to be easy to read in MATLAB’s visual variable editor. The second compresses trial results into a numeric matrix or other arrays to facilitate extracting/analyzing with MATLAB functions. Optionally runExperiment also saves results to both a .mat file and a .csv file at the end of each trial. The .csv file can be opened in other apps like Excel.

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. (Tip: if you have values for a trial that are not specific to one element object, you can make a trial object and set info there as well.)

Example

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 you can use showKey at the MATLAB command line to get key names.

newExperiment

<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;

        pic.report = <cdsm>"rotation"<cdsm>;
    <cdkm>if<cdkm> pic.rotation < 0
        pic.info.direction = <cdsm>"ccw"<cdsm>;
        pic.info.d = -1;
    <cdkm>else<cdkm>
        pic.info.direction = <cdsm>"cw"<cdsm>;
        pic.info.d = +1;
    <cdkm>end<cdkm>


    recorder = keyPressObject;

    recorder.listenKeyNames = [<cdsm>"left" "right"<cdsm>];
    recorder.translateResponse = [
        1 -1
        2 +1
        ];
    recorder.scoreResponse = true;
    recorder.correctResponse = pic.info.d;
    recorder.start.endOf = <cdsm>"pic"<cdsm>;
    <cdcm>% keyPress ends on its own when it records a response<cdcm>

    recorder.report = [<cdsm>"response" "responseScore" "responseLatency"<cdsm>];


    addTrial(pic, recorder);
<cdkm>end<cdkm>

[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.

Tutorial

See the results tutorial in <PsychBench folder>/docs/tutorials.