learningMatlab

View learningMatlab on File Exchange

What’s this?

Materials and exercises from the Introduction to Matlab Programming course which forms part of our MSc Cognitive Neuroscience.

For viewing the materials use: https://schluppeck.github.io/learningMatlab/

For inspecting the code and details: https://github.com/schluppeck/learningMatlab

Preliminaries

Get me started on the material here!

  1. The first place to check out is the aToZ-intro. Run through these exercises on the lab machines (or on your own copy of Matlab).

  2. Find PDF materials in one place in the matlab primer [PDF]

  3. Lecture slides for sessions 1-4:

Who is it for? What are the aims?

The main aims is to help the students to get to grips with the basic ideas of computer programming and, more specifically, the use of Matlab. The course materials started out for a graduate course for psychologists and neuroscientists.

The exercises draw on material that students on our MSc courses encounter in other modules. It’s therefore a great opportunity for hands-on revision of some important concepts such as

The syllabus is for a 10 week (10 x 2h) lab class, assuming very little computer experience (or maths) at the start.

Feel free to use the code. If you feel it’s particularly helpful to you… I accept donations in the form of freshly roasted coffee beans.

The course has two chunks. (Schluppeck has been tinkering with the course more recently and we’ve also done a different project around stimulus presentation.

  1. an introduction to the basic ideas (variables, functions, control flow) - running over the first 4 weeks. Check out the material in the aToZ-intro folder and the associated readme file here.

  2. Timetable A. A project, building some basic utilities / functions for looking at neuroimaging data and performing linear regression (GLM), 6 weeks. Details on the imaging-related units is outlined in here.

Timetable A (around a looking at images, 3d data, …)

Week Unit Topic
1 aToZ-intro What is Matlab, the environment, variables, indexing, …
2 aToZ-intro Types of data: numeric, logical, text, etc.
3 aToZ-intro Indexing, looping, branching, functions, …
4 aToZ-intro Understanding someone else’s code
5a imaging-00 What are images? How to display them
6a imaging-01 Building / fixing up a simple image viewer
7a imaging-02 A function that constructs a simple design matrix
8a imaging-03 Hands-on linear regression (using a sample timecourse)
9a imaging-04 Doing regression stats, displaying

How to get these materials

Assuming you are on a Mac: open up a Terminal (double-click /Applications/Utilities/Terminal). Then do the following:

# if you don't already have one: create a ``matlab`` directory in your home space (``~``), then change directory to it:
cd ~
mkdir matlab
cd matlab
# get MGL (for the behavioral project)
git clone https://github.com/justingardner/mgl.git
# get these tutorials
git clone https://github.com/schluppeck/learningMatlab.git

You’ll need to add both these subfolders to your path; then you should be good to go. A convenient way to do this is to run this or add this to your startup.m file:

addpath(genpath('~/matlab/'))

Grabbing updates

To make sure you have any updates to this material, open a Terminal, change directory to the learningMatlab folder and issue git pull. This will sync you the material on github. Alternatively, download the zip archive of the repository.

Notes

Colophon

Contact

https://twitter.com/schluppeck