There are two ways to make an experiment in PsychBench: the visual method for which you can use any spreadsheet app that can save or export to Microsoft Excel files, and the coding method for which you use a MATLAB script. The visual method is good for most experiments, even complex ones. The coding method is a bit more flexible and can be useful for unusual experiments, or just if you prefer it.
Let’s look at a simple example just to see the basic idea. We’ll make an experiment with three distinct trials. Each shows a picture of a different shape at a height of 10 deg visual angle. A trial ends when the subject presses the space bar. The experiment runs two repetitions of each distinct trial for a total of six trials, all in random order. The experiment reports which picture and response latency for each trial.
Visual method: Here are two sheets/tables in an Excel file that together would make this experiment:
Coding method: This isn’t actually that much harder. The following MATLAB script would make the same experiment:
newExperiment
fileNames = [<cdsm>"red cone.png" "green cylinder.png" "blue cube.png"<cdsm>];
<cdkm>for<cdkm> fileName = fileNames
pic = pictureObject;
pic.fileName = fileName;
pic.height = 10;
pic.start.t = 0;
pic.end.response = true;
pic.report = <cdsm>"fileName"<cdsm>;
recorder = keyPressObject;
recorder.listenKeyNames = <cdsm>"space"<cdsm>;
recorder.start.t = 0;
recorder.report = <cdsm>"responseLatency"<cdsm>;
addTrial(picture, recorder);
<cdkm>end<cdkm>
nn = randomOrder(rep(1:3, 2));
setTrialList(nn);
Of course this is an unrealistically simple example! However, it’s easy to do much more, like complex combinations of multiple factors, different trial types including intros, syncs, breaks, etc.