MATLAB for Coursera – Machine Learning

In the Coursera – Machine Learning class you can use MATLAB or Octave. MATLAB is free for the class and I decided to use it since I refer a GUI and I was told by my friend Kyle Prins that he used it in school and that people tend to continue to use it after school. The commands appear to be the same on both systems.

First, let me clarify that I am using a Mac and running MacOS El Capitan, 10.11.X. The course was developed in 2011 and the tutorial was in Octave. I was new to MATLAB and ran into some issues. Here is the MATLAB version that I ran and that I received through the course.


After the installation, we had to install the files that were provided via the course. You can file these files under the “Review” section on the bottom of Week 2 section, you will see “Programming Assignment”. Click this section and you will get the selection to download the files.

Review - Programming Assignment

You will have an option to download files. I saved them to a specific folder I created on my desktop.

files to download

Now that the files are saved, we can load them into MATLAB. I personally set the path to begin with but when I first ran, I just started at Step 6 (identified below). When I did this though, I got a pop-up window about setting the path. Click “Set Path”

set path

Select “Add Folder…”

add folder

I used the pop-up window to select the personal folder that I saved on my desktop and click “open”. My personal folder is called “Coursera-ML”.  Note that in the example below, I have already downloaded “machine-learning-ex2”, this is the week three assignment and the same process is used. “machine-learning-ex1” is the folder that I downloaded for the week two assignment.

exercise 1

and then click “Save”.


To get to the files, it is fairly easy and really, the simplest route…

STEP 6: Select the “browser for folder” icon

browse for folder

and then select the folder for the appropriate assignment.


Now all your files should appear on the left hand side of the screen, like below


Now you use the PDF in the download file/folder to follow along. In this example, the PDF is “ex1.PDF”


To get a file to “launch”, just double click it so you can edit it. In this example, I double clicked “ex1.m” and to appeared in the “editor” window.

launch file.png

I hope you found this helpful but feel free to add questions or make comments below.


  1. Machine Learning - Andrew Ng Week 2 - Big Data Beard

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.

%d bloggers like this: