This is a minimal example experiment designed to be a starting point for full experiments to be built from. Everything is split into functions and things are simple to change. Currently, the script sets everything up and runs a squeeze calibration (see experiment.m) and then runs 3 squeezes (see mainTask.m). An example of the data it outputs is in the example-data folder.
The mex folder contains mex files that I found in other people's experiments but they are not used here.
The biopac folder contains the matlab scripts and other code files that are used to communicate with the biopac. There is probably no need to change them.
The squeeze folder contains scripts that call the scripts in the biopac folder, to communicate with the biopac. It also contains functions that deal with displaying squeeze stuff on the screen.
Other working software combinations are available, but if you're downloading everything anyway, perhaps get the same versions that I am using to develop this:
- Windows 10 or 11 (I think Mac doesn't support psychtoolbox properly anymore?)
- Matlab R2023b
- Psychtoolbox version 3.0.19.7
- https://github.com/Psychtoolbox-3/Psychtoolbox-3/releases
- Download, unzip, navigate in matlab to the folder containing SetupPsychtoolbox.m and run that script. Might also need to add psychtoolbox to path in matlab (Home > Set Path > add the psychtoolbox folder)
- gstreamer 1.22.5 (MSVC, not MinGW)
- https://gstreamer.freedesktop.org/releases/ or https://gstreamer.freedesktop.org/data/pkg/windows/
- If matlab complains about it even after you've installed it, try adding a system variable names GSTREAMER_1_0_ROOT_X86_64 with value as the path to the gstreamer X86_64 folder.
Run the experiment.m script in MATLAB.
- When developing your task, it's easiest to use two screens. Have the matlab editor window on the second monitor, and when you run the task it will show on your laptop/primary monitor. This way, the command window is always visible whilst the psychtoolbox screen is open, so you can see any errors or outputs. Connect the screen before opening matlab otherwise matlab probably won't detect it. If you don't have two screens, you can set the psychtoolbox window size to just a section of the screen (by changing the value of
ex.display.screenRectin experiment.m) - If you want to close the PTB window without closing matlab, do the following:
- Press alt+tab to bring the matlab window into focus
- Press ctrl+c a few times or hold it down
- Type sca and press enter and PTB should close. Or, if it doesn't type into the command window yet, you need to press ctrl+c a few more times. sca means "screen close all" and it tells psychtoolbox to force-close its windows.
- If you install PTB and matlab and gstreamer on a new pc, make a note of the versions of all those things you use
The squeezy handle is called a dynamometer. The thing it is plugged into is called an MP150 or MP160 data acquisition device (we have some of both models) but for simplicity we just call them a "biopac" which is the name of the company that makes all this stuff.
The gain setting can be changed between 50, 200, 1000, and 5000 using the switch on the front of the biopac.
To see what changing the gain does, close matlab, open the biopac software (Acqknowledge), start recording, and try squeezing the handle at each of the different gain settings. It won't cause any damage to change the gain during recording.
With some setups, using 1000 or 5000 gain will clip off the top of hard squeezes, so it's best to avoid using these for your experiment. Other than that, people seem to have no particular reason for choosing between 50 or 200 gain - just make sure your choice is consistent across all participants otherwise it will be more difficult to compare/analyse.