Getting started / Making an experiment

Overview

There are two ways to make an experiment in PsychBench. In the visual method you can use any spreadsheet app, but Google Sheets is most common since it gives you dropdown menus and quick docs. In the coding method 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 an animal at a height of 10 deg visual angle. A trial ends when the subject presses any key. The experiment runs two repetitions of each distinct trial for a total of six trials, all in random order. The experiment reports picture file name and response latency for each trial.

Visual method: Here are two sheets/tables in a Google Sheets file that 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.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 extremely minimal example! It’s easy to do much more, like complex combinations of multiple factors, different trial types including intros, syncs, breaks, etc. See for example demos and examples. A good place to start can be the tutorial video.