Skip to content

charleyr0/matlab-biopac-template

Repository files navigation

matlab-biopac-template

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.

Requirements

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:

How to run

Run the experiment.m script in MATLAB.

Using psychtoolbox (PTB)

  • 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.screenRect in experiment.m)
  • If you want to close the PTB window without closing matlab, do the following:
    1. Press alt+tab to bring the matlab window into focus
    2. Press ctrl+c a few times or hold it down
    3. 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

Using the dynamometer and biopac

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.

Biopac gain settings

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.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors