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;
pic.report = <cdsm>"rotation"<cdsm>;
<cdkm>if<cdkm> pic.rotation < 0
pic.info.direction = <cdsm>"ccw"<cdsm>;
pic.info.d = -1;
pic.info.direction = <cdsm>"cw"<cdsm>;
pic.info.d = +1;
recorder = keyPressObject;
recorder.nn_listenKeys = [37 39];
recorder.translateResponse = [
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>];
[results, resultsMatrix] = runExperiment;
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.