This is an old revision of the document!


Classification tutorial setup

If you have used matlab before and are reasonably comfortable downloading and installing files, just go ahead and follow the directions here. Otherwise, follow the directions below to run on a Mac with Matlab.

If instead you want to run on your own laptop and don't have Matlab installed, then it is possible to run this using the corn server, but it's a bit more involved and doesn't always work great - so I don't necessarily recommend it. Here are instructions if you want to try below.

Alternatively, if you will be using Matlab a lot in the future and would like to purchase a license, you may be able to purchase a student license (though that license has a limit on matrix sizes). See https://www.mathworks.com/store/link/products/student.

If you want to run on Windows then you can follow instructions here, but really, must you run Windows?

iPython Classification tutorial

Mac

  1. Mac with Matlab You will need to locate a Mac with Matlab installed. Many residential halls have such a Mac as well as the Library.
  2. Download tutorial files The tutorial requires a few files that you should be able to download to the Desktop. First, follow this link http://gru.stanford.edu/pub/classification.tar.gz It should download a file called classification.tar.gz to your computer.
  3. Move tutorial files to Desktop It will be easiest if you move the downloaded file “classification.tar” to your Desktop (note it may say, classification.tar.gz if it is still compressed - this should not matter). In Safari you can click on the icon at top right with the arrow pointing downwards, and you should be able to drag and drop. If you are using some other browser, or can't get that to work, then Navigate with Finder to the directory “Downloads” (which is under your User directory) and then drag and drop that to the Desktop.
  4. Uncompress/tar the file The file classification.tar is a special format which makes it easier to send as a single file, but contains a directory full of files. To undo that, just double-click on it and it should turn into a directory called classification. Inside should be a bunch of files with the .m extension (matlab files) and a directory called mrUtilities.
  5. Start Matlab Go ahead and start Matlab. You should be able to find an icon like the following and click on it If you can't find the icon go to search (magnifying glass in top right) and type matlab…
  6. Install tutorial Now you need to tell matlab where to find the files we just downloaded. You should type the following commands
    addpath(genpath('~/Desktop/classification'))

    It should look like this

  7. Test If everything worked ok, you should be able to type the following command:
    classifyTest

    and see the following:

  8. Done Great! Go ahead and try the tutorial

Corn server

Stanford provides a campus wide Matlab license that everyone can connect to. This section will get your computer set up to use it.

  1. Check if you have XQuartz installed First check to see if you have XQuartz installed. XQuartz (formerly X11) is a unix window management system which allows the matlab running on the corn server to display figures on your screen. Click on the magnifying glass at top right in the menu bar, type in “XQuartz” without the quotes and if it fills it in and there is an application to start, then hit enter, and it should start XQuartz. If not, it won't find X11 and it won't start, so you will need to install it.
  2. Install XQuartz Skip this if in the above step you were able to start XQuartz. Otherwise, you may be brought to a dialog that tells you that XQuartz is no longer part of Mac OS but can be installed. Follow the directions and download and install XQuartz. You can also download X11/XQuartz here or as part of the XCode package here: Xcode. Once XQuartz is installed, make sure to run it, by clicking on its icon or going to spotlight as above.
  3. Check XQuartz is running If XQuartz is open, you should see an icon like the following in your task bar to show that it is running:

  1. login to corn Type into the Terminal command line (get to the terminal by going to spotlight -i.e. magnifying glass at top right - and typing terminal), the following (make sure to change jlg to your sunet ID!!!)
    ssh -X jlg@corn.stanford.edu
  2. Enter your sunet password When prompted (nothing will show, this is normal) It should look something like the following
  3. Load up matlab module When you have logged in, then you need to load and start matlab. Type the following in and press enter
    module load matlab/r2013b
  4. Load classification tutorial Run the following commands to get the classification tutorial code
    wget http://gru.stanford.edu/pub/classification.tar.gz
    gunzip classification.tar.gz
    tar xf classification.tar
  5. Run matlab You are ready to start up matlab now. It is probably a good idea to run it without the desktop, which may work better:
    matlab -nodesktop
  6. Matlab GUI check If the Matlab splash screen then pops up on your desktop, great! If not, it might be because X11 is not working. If X11 is not running correctly or is an older version (There were issues previously running with Yosemite - as of XQuartz 2.7.11 and Mac OS 10.12.1 things are working), you may see the error
    Warning: No display specified.  You will not be able to display graphics on the screen.

    For Mac OS Sierra, the problem may be that the location of the XAuth program needs to be specified in the file /etc/ssh/ssh_config. To fix that you can do the following:

    cd /etc/ssh
    sudo emacs ssh_config
    Type in the line: XAuthLocation /usr/X11/bin/xauth
    Save the file by doing ctrl-x ctrl-s and quit by doing ctrl-x ctrl-c

    Another possible problem is that you may not be able to load the module, and you will see the following

    module: Command not found.

    If you see this message after typing “module load matlab”, this means you have an older account where the module environment is not set up properly. Follow instructions here. If everything went well, you should see the following

  7. Set path in matlab At this point, you should have the Matlab desktop open, and should be able to run the following to add the classification tutorial to the path
    addpath(genpath('classification'));
  8. Test If everything worked ok, you should be able to type the following command:
    classifyTest

    and see the following:

  9. Done Great! Go ahead and try the tutorial