Getting Started in MATLAB

MATLAB is available on the cluster machines, or if you prefer, you may purchase the student version for about $100 at the bookstore.  To open MATLAB on a cluster machine, go to the folder "Cluster Applications" and double-click on the MATLAB icon.  On a unix or linux machine, just type matlab.

The prompt looks like  ">>" and you might start by going to the helpdesk:

     >> helpdesk
Look for the link "Getting Started" for a gentle tutorial.

Saving Your Work:   Before you can really get started you need to take care of some technical details like how to save your work.  There are several possibilities, but first you must tell matlab where to keep your saved files and where to look for files you want to open.  Type

     >> pwd
     >> dir
to see the directory or folder matlab is currently using and the files currently available to matlab. If you are working on a cluster PC, you need to save all your personal files in the H: drive. You will need to do this every time you want to create new files or open old ones.

Perhaps the simplest way to save the results of your work is to cut and paste between your MATLAB window and your favorite text editor.  This works quite well.  Another possiblility is the diary command.   For example, if you type

     >> diary hw1.txt
then MATLAB will save all the commands you type and most of the output in a text file named "hw1.txt".
When you are finished, just type
     >> diary off
to end the text record of your session.  You can then open this text file in an editor like Word or Emacs and edit it to put together a report to turn in.  For more information try
     >> help diary
The diary command just keeps a text record of your session. You cannot reload it into MATLAB. So if you are working on a big problem you might want to save some of your work in a form that can be reopened so you can pick up where you left off, with all your MATLAB definitions reinstated automatically.   For this you would type something like
     >> save hw1
Then all your matlab definitions will be saved in a file called "hw1.mat".  When you open matlab again later you can restore your definitions by typing
     >> load hw1
(Of course you must set the path to tell matlab where to look for this file if you are working on a PC.)  The command
     >> whos
will remind you of the variable names you used in your saved matlab session.