Configuring MATLAB for Use in the CADLAB

Background

This document describes a way to configure your CADLAB account to make it easier to work with MATLAB. There is no rocket science involved. It is also possible that alternative account configurations might be preferable.

The steps described below will help you with the following

  1. Creating a folder (directory) hierarchy for storing often-used MATLAB documents.
  2. Configuring the internal MATLAB path so that your often-used documents are readily available.
  3. Setting up a desktop shortcut to exploit the two preceding items.

You can also skip the rest of this web page and instead download a two page summary in PDF format.

Page 1: Creating the shortcut to MATLAB.

Page 2: Modifying the shortcut so that MATLAB starts in N:\MATLAB

A Home for Your MATLAB Utilities

I have written several hundred MATLAB programs. Groups of programs are related to different tasks: data reduction and analysis, simulation of heat transfer or fluid flow, least squares curve fitting, photo manipulation, etc. To organize the MATLAB programs for these different projects, I keep each group of related programs in a separate directory.

I also have a handfull of MATLAB functions that I use in many different MATLAB projects. Two examples of these utility functions are

addpwd     Add the current working directory to the path for this MATLAB session
thickLines     Increase the line thickness and default font size for all subsequent plots. This is a preemptive action that allows you to save and then reduce the size of an image without causing the plot features to become too fine.

I want to maintain only one copy of these functions, while at the same time I want to be able to use these functions in all my MATLAB programming projects. In other words I want to create a library (or toolbox) of functions that will always be accessible when I am doing work in MATLAB.

After you obtain programs for your library (i.e. after you have downloaded the functions or written them yourself), you will need to store them in a directory. I use a directory called MATLAB in my "home" directory. If you are a CECS student, your home is the directory you start in after logging on to the CECS Windows Server.

Do not store all of your MATLAB files in your "MATLAB" directory. Rather, only put those files that are common to all uses of MATLAB there. The most important file to put in this directory is the pathdef.m file that is created by the path browser (more on this, below).

Here are the steps for creating a central MATLAB directory in your home directory.

  1. Log on to your CADLAB account
  2. Click on icons to move into your virtual N: drive
  3. Right : "New" >> "Folder"
  4. Name the folder "MATLAB" (or "matlab" since Windows files are not case sensitive.

Creating a Desktop Shortcut to MATLAB

The CECS Computer Action Team (CAT) configures the computers in the CADLAB to allow you to launch MATLAB from the Windows Start Menu. Using the Start Menu is workable, but it leaves starts your MATLAB session in a directory that you cannot use for storing files. This is confusing for new users, and it is an annoyance for experienced users. The solution is to create a desktop shortcut to MATLAB, and configure the shortcut so that MATLAB starts its session in a convenient directory.

First, Create the Desktop Shortcut

The first step is to create a desktop shortcut. Once it is configured, you can double-click on the shortcut to launch MATLAB.

  1. Log on to your CADLAB account
  2. Right-click anywhere on the desktop
  3. Select "New" >> "Shortcut" The pop-up menus will look like those in Figure 1.
  4. Click on the "Browse..." button in the "New Shortcut" Wizard. Use the following steps to locate the "matlab.exe" program. Note that you may need to scroll down to find a particular icon. Completion of the following steps yields a dialog box like that in Figure 2.
    1. Click the "+" sign next to the "Drives" icon
    2. Click the "+" sign next to the "Programs" Folder icon
    3. Click the "+" sign next to the "matlab6p5" Folder icon
    4. Click the "+" sign next to the "bin" Folder icon
    5. Click the "+" sign next to the "win32" Folder icon
    6. Click on the "matlab.exe" icon
    7. Click "OK"
    8. Click "Next >>"
    9. Specify a name for the shortcut. The default "matlab.exe" is fine, but a more description name like "MATLAB R13" (for release 13) would be better.
The result of the preceding steps is an icon on your desktop
Creating a new desktop shortcut

Figure 1: Creating a new desktop shortcut.

Completion of path to matlab.exe in New Shortcut Wizard

Figure 2: Completed specification of path to matlab.exe in the New Shortcut Wizard.

Second, Configure the Shortcut

Configure the shortcut so that when it launches MATLAB, it starts in your MATLAB directory, not the system directory for the MATLAB executable.

Using the MATLAB Path Browser