Matlab in the Campus Computer Labs, Fall, 2000

The following comments about using MATLAB in the campus computer labs may be useful. First of all, MATLAB is no longer being developed for the Macintosh. We therefore recommend that you try to run MATLAB on a Windows PC or a UNIX machine (e.g., a SUN Sparc Ultra). (The MATLAB software is also available for LINUX, but as far as we know there are no LINUX open workstation labs on campus. It is also possible to run the PC version of MATLAB through a Windows emulator on a Mac, but as this is cumbersome, we don't recommend it.) A list of Open Workstation Labs on campus where MATLAB is installed may be found here. However, several of the labs listed there under "Matlab SUN" also have "Matlab Windows" on different machines. The math department OWL lab (MTH 0203) has been refurbished with new computers and high speed networking.

On a UNIX machine (e.g., part ofthe GLUE system), you can create and edit diary files and M-files and run MATLAB from the command window, but you cannot run the M-book notebook interface. To run MATLAB in the WAM and GLUE labs on a UNIX workstation, type tap matlab from the UNIX prompt in a terminal window. Then when you get a new prompt, type matlab (not followed by an ampersand). MATLAB will start in the same terminal window. To open the M-file editor/debugger, you have to use the edit command in the command window, as there is no toolbar at the top as on a PC.

On a WAM or OWL PC, start MATLAB from the "Start" button in the lower left of the screen. Go to "Programs", then to "Applications". In the WAM labs (e.g., PG2 and Worcester Hall), not all methods for launching the M-book interface will work, because of networking issues too complicated to discuss here. Therefore you cannot launch a new M-book simply by typing notebook from the MATLAB command line. Instead, follow these steps:
  1. Click on "New Office document" from the "Start" button menu, or launch MS Word some other way and choose "New" from the "File" menu.
  2. In the box that comes up, look for the tab that says "Matlab", and select "M-book" from the box under this tab (in fact it's the only option there). This will launch a new operating M-book into which you can type commands, and will open MATLAB automatically if it is not already open. You can save your M-book into any of the usual directories on which you have write permission, such as "My Briefcase", "C:\TEMP", or your home directory, designated "H:\". Be sure to save your work as a Word document (*.doc file), not as a document template (*.dot file).
  3. If you have an existing M-book which you want to open, selecting it from the "Open" option in the "File" menu in MS Word may or may not open it as an M-book. (We have found that sometimes it comes up simply as a non-executable Word document.) If it does not launch as an M-book, do not panic. Instead, open a blank M-book as above (not with the "New M-book" option from the "File" menu in an existing M-book, which seems not to work). Then in this blank M-book, choose "Insert file" from the "Insert" menu and that will allow you to paste in the existing M-book.
  4. Under some circumstances, you may find that an M-book will not operate because of a warning message that "macros have been disabled". If this happens, go to "Macros" near the bottom of the "Tools" menu, click on "Security", and lower the security setting on MS Word to "Medium" or "Low". Then reopen the M-book and try again. (It might be necessary to close Word and reopen it first.)

Working Directories

The default directory where MATLAB launches is on most machines not a directory where you can write and save files. You should use the "cd" command within MATLAB to switch to your home directory, called "H:\" on the WAM PC's, or to some other suitable directory as discussed above. Now you can write mfiles in this directory and MATLAB will be able to find them.

Diary Files

When you write a diary file, with a name like "prob1diary", it is stored in the current directory. However, it is not a MATLAB m-file, because it contains not just MATLAB commands but also output, warning and error messages, etc. If you want to open it with the MATLAB debugger/editor, you need to do so as a text file, not as an m-file. (For this reason, you should not give a diary file a name of the form *.m; a name of the form *.txt is preferable.) To see what is in the diary file, and to edit it, use a plain text editor, such as "emacs" on a UNIX machine or "notepad" on a PC. You can find "notepad" from the "Start" menu on a PC.
Dept. of Mathematics, University of Maryland, College Park