Welcome to the course website for Advanced Research Methods: Matlab
My drop-in sesions will be onlines. You can book through my calendly page
You can join the Slack channel for this course by using this invite link.
Before the first class you should‘ve created an account with Mathworks.com and you should‘ve linked the Sussex license code to your account.
To install Matlab on your own computer follow the instructions at the link below:
Installing Matlab on your home computer
I‘ll be using Matlab 2021b, but you’re welcome to use any verion from 2019b onwards. When installing Matlab, I would recommend also installing the statistics toolbox because it contains some functions that may be useful for the assessment.
The instructions will explain how to set up an account on Mathworks that is linked to Sussex license code. One you have an Mathworks account linked to the Sussex license code, then you‘ll also be able to access Matlab online at the link below:
In addition to installing Matlab
you should also install PsychToolbox
The easiest way to install PTB is to download the DownloadPsychtoolbox.m
file from the PsychToolbox website or you can just click here.
You can then run…
to install it…
Before the course started, it would also be great to get a sense of your previous programming experience and any particular methods or techniques you’re interested in. I’d like to make the course as relevant to your needs as possible. Follow the link to the survey below
Shown below are the responses from people that have already filled in the survey
Matlab
is a high-level programming language1 that is specialised for dealing with matrices. Other programming languages that support matrix/array programming are Julia, APL, R (Python can support it through extensions, but not straight out the box)Matlab
for many of the kinds of tasks we want to do in Psychology research e.g., signal processing (EEG research), image processing (vision research), modelling (psychophysics and signal detection)This is generally because a lot of popular toolboxes have been implemented in Matlab
FieldTrip: EEG, MEG
SPM: EEG, MEG, fMRI, PET, DCM
EEGLab: EEG
PsychToolbox: For running experiments
Most of these packages are for analysing data matrices
This course website will contain all the materials for this mini module. The relevant pages will be linked on canvas, but you might find it easier to bookmark this page.
Because this is primarily a programming course, the materials will include lots of code snippets. A example of a code snippet is shown below:
You’ll be able to copy this code by clicking on the Copy code button. Then you’ll just be able to paste it into Matlab
using cmd + c (MacOS) or ctrl + c (Windows). You‘ll also be able to download a file of the code snippet by clicking the link below (e.g., the link above that says Download test.m)
Sometimes I‘ll also show you want some Matlab
output will look like. For this, you‘ll see boxes that look like this one below.
For output boxes, you‘ll be able to see the command typed at the command prompt (shown as >>
) together with any output that command produced.
This is a rough outline of the course topics
Introduction to programming
The basics of the Matlab IDE
How to get help
Using functions
Variables types and working with variables
Our first script
Writing our first function
Variable scope
Flow control and logic
Loops
Introduction to PsychToolbox
Reading and writing data
The assessment
If you’ve used R
before, then you might find the Matlab
to R
cheatsheet useful. You can access it here.
Matlab for neuroscientists, as the name suggests, a book focused on Matlab
for neuroscientists.
An introduction to MATLAB for Behavioural Researchers may also be worth checking out.
Peter Scarfe’s PsychToolbox Demos provides lots of good examples on using PsychToolbox
.
And lastly, the Mathworks File Exchange is a great resource for finding code that you can reuse in your own projects.
The details about the assessment are available on the assessment page.
The assessment for this mini-module might at first look seem really difficult. But I want to stress that you can make use of all the resources available to you. As you progress on your research career you’ll be faced ever more difficult programming challenges. You won’t always know how to solve these yourself, so a valuable skill to learn is how to adapt and repurpose example code you find online.
When referring to programming languages ‘high-level’ means that there is a high level of abstraction from the instruction set the computer is actually using. High-level languages look more like natural human language.↩︎