Using MATLAB from the CIS Public Labs

T. Bennett

September 1, 1995

In order to use MATLAB version 4.2 with graphics, you need to run X-windows. The method for starting up X-windows is different, depending upon which machine you choose to use. After you have X-windows running, using MATLAB is the same on each machine.

Index


Macintosh
Turn on the machine by pressing the button in the upper right-hand corner of the keyboard. With the mouse, double click on the following icons: The eXodus II screen will come up and you will be prompted to login. After logging in, you will be connected to a server which runs X-windows. Then type the following:

setup matlab

The machine will respond with

setup: package `matlab' is setup"

Next type

matlab

You will then get the xterm window, the MATLAB graphics screen will flash on and then off, and MATLAB is ready to use. To exit, do the following:

Sun SPARC work station
These machines are always left turned on. You may have to hit return a few times to get the login prompt. After you have logged in, type the following:

startx

setup matlab

The machine will respond with

setup: package `matlab' is setup"

Next type

matlab

You will then get the xterm window, the MATLAB graphics screen will flash on and then off, and MATLAB is ready to use. To exit, do the following:

Make sure that you see the login prompt before you leave the machine. This ensures that you are logged off of the network.

Digital DEC servers
These machines are usually turned off, so you will probably have to turn the machine on. The location of the switch may vary with the machine. Use machines that have model numbers higher than 316, or any one which runs windows. When the machine boots up, you will see a startup menu, from which you should choose number 2, which is windows applications. You will be asked to log in. With the mouse, double click on the following icons: The eXceed screen will come up and you will be prompted to login. After logging in, you will be connected to a server which runs X-windows. Then type the following:

setup matlab

The machine will respond with

setup: package `matlab' is setup"

Next type

matlab

You will then get the xterm window, the MATLAB graphics screen will flash on and then off, and MATLAB is ready to use. To exit, do the following:

Printing Graphics
Once you issue the MATLAB command plot(x,y), the graphics window will come up on your screen to show your plot. To save this plot and get a hardcopy, click the mouse button in the MATLAB command screen and type print fname", where fname is a name you have chosen for the file. This will put a postscript file called fname.ps in your directory on the unix server. To print this file, quit MATLAB and type

ls (This should verify that the file fname.ps is in your directory.)

Then type

lpr -PBEH -Dpostscript -N0 -K1 fname.ps"

This command sends the hardcopy to the computer lab in Benedum Hall. If you wish to send output elsewhere, you will have to change the -PBEH" part of the command. There is an instruction sheet on print commands available in the public labs.

Printing Diary Sessions
The diary command in MATLAB will save everything that appears on the screen after you issue the command to a file called diary. To save your session to a different filename simply type diary fname, and everything that appears on the screen will be written to the file named fname. You can type diary off" to stop output from being sent to the file. Type help diary" in MATLAB for more information. If you know how to use a unix text editor, you can quit MATLAB and edit the file to cut out unwanted parts and add your own text before you send it to the printer. To print, quit MATLAB and type

ls (This should verify that the file diary is in your directory.)

Then type

lpr -PBEH diary"

Note: In the above UNIX commands ls and lpr, it is the letter l being used and not the number 1. There is a very helpful document called Basic UNIX Commands which is available in all of the CIS public labs that explains these commands further.

Accessing MATLAB from home
If you are able to connect to the university's network from home, then you can use MATLAB at home. To do this, log in to a university machine (unixs or axpvms). At the prompt, type

telnet scorpion.labs.cis.pitt.edu"

You will be asked to log in to this machine, and then type

setup matlab"

matlab"

You can now use MATLAB just as you would in a public lab, except that the graphics will behave differently.



Return to Math 25 Information