Getting around Matlab


Teaching: 5 min
Exercises: 10 min
  • How do you get set up in Matlab?

  • Understand that Matlab is a text-based programming environment.

  • Learn how to set the path for toolboxes.

Before we get started with MGT, we will familiarize ourselves just a little bit in Matlab.

Your first Matlab scripting

Matlab is a scripting language, in which you type a message in the command window and press Return. Try to type in the following lines:


One of the strengths of Matlab is to be able to work with symbols. Try this:


You can also try combinations of symbols and numbers:


The semicolon

The semicolon is important in Matlab. Look at the difference between this:


and this message:



One of the big strengths of Matlab is all the plotting functions. Try this example:

xlabel('x = 0:2\pi')
ylabel('Sine of x')
title('Plot of the Sine Function')

That is about what you need to know to get started with MGT.


If you ever get stuck in Matlab, you can press Ctrl+C to interrupt the running process.


One of the strenghts of Matlab is that there are lots of toolboxes available. The MGT is one such toolbox, and it builds on some other toolboxes: matlabPyrTools, MoCap Toolbox and MIRtoolbox. For these toolboxes to work properly, we need to add them to the path of Matlab. That is a location for extra stuff that we want to add. This should typically be a folder in your home folder.

Adding path

Add the files from the workshop zip-file to your Matlab path: under the “Home” section, click “set path”. Click the “Add Folder” button and choose the “source-code” folder and finally click “save”.

It is also possible to set the path via the command line in Matlab, using something like:


When you are done, you should be able to run the following command:


Key Points

  • A semicolon at the end of a line will not display the commands output.

  • Toolboxes need to be added to path before they can be used.