Psych 599: Introduction to Psychtoolbox in Matlab
Download the syllabus (Word)
Course Description
This course covers the basic of programming Matlab using the Psychophysics Toolbox functions that are relevant to running experiments in the behavioral sciences. We will cover some basic Matlab concepts, but this is not intended to be a comprehensive course in Matlab programming. We want to give you only as much Matlab as you need to know to get started with the Psychtoolbox. You will first learn some Matlab syntax and programming skills before we delve into the specifics of how to use the Psychtoolbox functions. We will cover how to control the screen, how to create and present visual stimuli, including shapes, text, animations, and movies, and how to present sounds. We will also cover response collection and precise timing measurement. Some basic proficiency with computers is all that will be assumed, but of course any background in scripting and programming will be to your advantage here.
Class One
Introduction to Matlab:
- Installing Matlab and Psychtoolbox
- A tour of Matlab
- Basic programming concepts
- Coding practices (commenting, indentation, etc.)
- Variables and data types
- Working with vectors and matrices
- Functions and scripts
Download lecture slides (Powerpoint)
Class Two
Deeper into Matlab:
- Finding values in a matrix
- Logical indexing
- Truth testing
- Conditionals
- Loops
- Reading and writing files
- Accessing the screen in PTB
Download lecture slides (Powerpoint)
Class Three
Into the Psychtoolbox:
- Debugging
- How monitors work
- Screen timing
- Understanding color
- Drawing basic shapes
- Alpha transparency
- Drawing Text
- Animation
- Presenting images
Download lecture slides (Powerpoint)
Class Four
Visual presentation, animation, and movies
- Drawing text
- Animation
- Presenting images
- Playing movies
Download lecture slides (Powerpoint)
Class Five
Sound and collecting responses
- Creating and playing sounds
- Recording sound
- Collecting input from keyboards, mice, joysticks
Download lecture slides (Powerpoint)
Class Six
Randomization, code organization, etc.
- Using the DAQ toolbox
- Randomization, permutation, condition order
- Priority handling
- Handling complex code: subfunctions
Download lecture slides (Powerpoint)