Back to Main Page

Matlab Practical 2

Introduction to PTB in MATLAB


Goal for today

  • In this practical we’ll be programming up a simple experiment in PsychToolBox
  • We'll then run the experiment and collect a little bit of data that you'll be able to analyse

First lets make sure we have the newest version of the sample code

Make sure you're in the pbs2-prac-code-master folder then type the following commands

websave('getfiles.m','https://tinyurl.com/get-pbs2')

getfiles

Planning an experiment

It might sound obvious but the first thing to do before you start programming up an experiment is to plan it out. Some of the things you'll need to think about include:

  1. What will the stimuli be?
  2. What order will they be presented in?
  3. How many trials will there be?
  4. Will the trials be presented in blocks?
  5. How much time will there between each stimulus?
  6. What kind of responses will be collected?

Coding the experiment

  • Once you know all the parameters (stimulus type, stimulus timing etc) you can start planning how you're going to code it up. You can start planning how you'll actually write the program.

  • A lot of the time you'll be able to program up your experiment using reusable chunks of code, so you'll just need to think about how to put those building blocks together.

  • Flow charts are really useful for this planning process