
The ECN No Name Newsletter is no longer being published. This is an archived issue.
[previous article] [next article]Stacey Clark and Irfan Tusneem
Sometimes getting started running a software package can be an experiment in frustration unless you know the necessary "incantations" to get the program's attention. Once started, it becomes important to be able to print and exit. Here are a few helpful hints.
You may begin to use MATLAB by typing "matlab" (version 4.0 on Sun 4s and version 3.5f on Sun3s) or "/usr/unsup/matlab" (version 3.5i on Sun 4s and version 3.5f on Sun 3s).
If you are using a Sun, you should go ahead and run a windowing package, so that you can display graphical output. If you are using X11, X detects that you have a bitmapped display. You will want to set the terminal type to x11 (xterm = xterm, X graphics) HELP, DEMO, INFO, and TERMINAL are available.
>> terminal
----- Graphics Terminal Types -----
1) VT-240 & VT340 Regis
2) VT-240 & VT340 Tek mode
3) VT-241 & VT341 Color
4) Tektronix 4010/4014
5) Tektronix 4100 series
6) Tektronix 4115 series
7) VT100 with Selanar 100
8) VT100 with Selanar 200
9) Human Designed Systems
10) Graphon
11) xterm
12) Macintosh with VersaTerm
13) More selections - - -
Select a menu number: "11".
If you are using SunView, one way to display the output is to type "tektool". This turns your monitor into a tektronics display. You will wish to pick a tektronics terminal type for the "terminal" designation. Select a menu number from the menu above: "4". Then you can easily display graphs with the plot command.
If you wish to clear the monitor display, press "return" to stop previewing the plot or at the MATLAB prompt (>>) type "!clear". A tektronix screen is set up to just keep overwriting until you do the clear command.
To print from MATLAB, there are a couple things that you can do.
The diary command will let you save everything you do into a file. This is similar to the typescript command. At the MATLAB prompt (>>) type "diary filename".
While inside MATLAB, you can use the meta command to save graphics as a metafile. For example:
% matlab >> x=[1 2 3 4] >> y=[10 20 30 40] >> plot(x,y) >> meta fname <-- the graph is still displayed at this time >> quit %
A filename fname.met is created.
% gpp fname.met -dps
A postscript file is created, that can be sent to the laser (or a different -d options can be used for other printer types).
% lpr -Pca4 -h fname.ps
You can also set up your default printer, and then use the print command while graphics are plotted on the screen. For example:
>> plot(x,y)
Graphics will be displayed. Move the mouse
out of the graphics window and type:
>> print
There will be verification that the plot
is sent to the printer.
One way to set up your default printer is to use an environmental variable PRINTER. In csh, the command is "setenv PRINTER ca4" (change the ca4 to the printer you use). This command can go in your .login file, so you don't have to remember to specify it before you get into MATLAB.
When working on Sun-4s instead of using meta, you need to use the print command.
>> print -dps filename.ps % lpr -Pca4 filename.ps
You can still use the setenv command to set printer and then use the print command to print the plot to that printer.
% setenv PRINTER ca4 then from matlab >> print
To exit, type "quit" at the MATLAB prompt (>>).