Getting Started with MATLAB

You are responsible for obtaining a copy of MATLAB to use for the duration of the course; to help you, we have prepared this guide, which lists a number of ways you can get a copy as a Stanford student.

Software Versions

MATLAB is updated twice a year, and the latest version is R2016a. Fortunately, MATLAB code, data, and figures are compatible across a range of versions. For this course, any reasonably recent version from the last five years will suffice; if you’re using a version that’s on the older side, there’s a chance that some function or feature we suggest you use will be missing or won’t work as expected, but if this happens we’ll work around that. In short, get the most recent version of MATLAB you can but don’t sweat it.

The core MATLAB software is also augmented by a variety of extensions known as toolboxes, which are collections of functions useful for a specific purpose (e.g., image processing, financial applications, or neural networks). You won't need any special toolboxes for this course, although if necessary we will provide specific functions if the need arises.

MATLAB requires a paid license

MATLAB software is not free; it is developed and sold by a company called Mathworks, and runs under license control. This means that when you install MATLAB it will ask you to enter license information, which is done either by entering a string of characters, or by following their prompts to go log into their website and select a license to retrieve. Depending on how you get your MATLAB license, the installation and authentication process will be different. We therefore can’t provide a step-by-step guide, but it’s usually pretty straightforward.

How to access MATLAB as a Stanford student

  1. Get it from your PI or rotation lab
    You (or your PI/research advisor) can purchase copies of Matlab for (a heavily discounted) price of around $75 from the Stanford software licensing store. Additionally, your lab may already have machines with Matlab installed or copies of the software lying around for lab use.

  2. Download it from the Stanford Computational Services and Bioinformatics Facility (CBSF)
    If your PI or research lab is part of the “Computational Services and Bioinformatics Facility” (CBSF), you can download Matlab for free from the CBSF website.

  3. Use Stanford's network computing resources (FarmShare and Corn)
    Stanford provides network computing resources for students, and as part of that, you have access to a bunch of machines (known as “FarmShare”) that run Matlab. The specific group of servers is known as the “Corn” computing cluster - you may hear us use the phrase, “log in to Corn” or “running on Corn” to refer to using these machines.

You can find instructions on how to access the Corn cluster from Stanford IT Services, and once logged in, there is a guide on how to run Matlab at the FarmShare website.

    1. (Mac OSX only) To use the graphical user interface (GUI), you will need to make sure that you have X11 forwarding set up. I believe that this comes pre-installed on Macs running OS X versions 10.7 and earlier, but if you are running the newest version (10.8 Mountain Lion), you will need to install X11 yourself at the XQuartz website.

    2. First, open up the Terminal application

    3. Type ssh -X to log into the Corn server (you will need to replace mysunetid with your own SUNetID username)

    4. Load the Matlab module by typing: module load matlab

    5. Run Matlab by typing: matlab

    6. If everything is working, the Matlab desktop environment should load. If you don't have X11 forwarding set up, you may get the following message: Warning: No display specified. You will not be able to display graphics on the screen.

    7. When you are done using Matlab, you can logout of the server by typing logout

If all else fails, please contact us! We don't want difficulty with accessing Matlab to be the preventing you from taking the course.