Next Previous Contents

14.6   MatLab

  Printing fails under Linux

From John Weber, Tue Sep 26 10:43:38 2006 Subject: TicketID#20060925102027

This is a known bug, please see:

Matlab printing solution.

  Stuck processes after logout

From Anthony Martinez, Tue May 3 18:26:04 2005.

matlab likes to fail to exit in such a way that it blocks on IO but sucks all the CPU. If the STAT code for ps is not R (for running), it's probably D which is I/O blocked, and if it is then you should feel free to kill it, since it's not actually doing anything.

  Checking licenses

From Michael Martinez, Fri Feb 25 11:15:23 2005

If the license manager won't allow matlab to run again please run the following command and send me the output in a ticket.

    (on rainbow): /usr/bin/matlab-R-14/etc/lmstat -a

  Machines hosting matlab

From Michael Martinez, Tue Oct 26 09:08:02 2004

Not all computers have matlab installed. It is not part of the Linux distribution. A list of computers with matlab is provided below.

aspen
bagend
basil
bobcat
buckeye
cheetah
couger
cypress
euler
gauss
genius
hammerkop.nmt.edu
hydra
jaguar
leopard
library208-1-2
library208-2-1
library208-2-2
library208-3-1
library208-3-2
library208-inst
margay
meinzer.nmt.edu
msec187-1-1
msec187-1-2
msec187-2-1
msec187-2-4
msec187-inst
ocelot
oncila
panther
pear
rainbow
rammstein
rison-laptop
sac-1-2
sauron
serval
speare116-1-3
speare116-2-3
speare116-2-4
speare116-2-5
speare116-3-2
speare116-3-4
speare116-3-5
speare116-3-6
speare116-4-3
speare116-4-4
speare15-1-10
speare15-1-12
speare15-1-13
speare15-1-14
speare15-1-5
speare15-1-9
speare4a-2-3
speare4a-2-4
speare4a-2-6
speare4a-3-7
speare4b-2-1
speare4b-2-2
speare4b-2-3
speare4b-2-4
speare4b-3-1
speare4b-3-4
speare4b-3-5
speare4b-3-6
speare4b-3-7
speare5-1-10.nmt.edu
speare5-1-15
speare5-1-2
speare5-1-3
speare5-1-4
speare5-1-6
speare9-1-10
speare9-1-11
speare9-1-14
speare9-1-6
speare9-1-9
weir128-1-1
weir128-1-3
weir128-1-4
weir128-1-5
weir128-2-2
weir128-2-3
weir128-2-4
weir128-3-2
weir128-3-3
weir128-3-4
weir128-3-6
weir209-1-1
weir209-1-2
weir209-1-3
weir209-1-4
weir209-1-5
weir209-2-1
weir209-2-2
weir209-2-3
weir209-2-4
weir209-2-5
weir209-2-6
weir209-3-2
weir209-3-3
weir209-3-4
weir209-3-5
weir209-3-6

  Printing work-around

From Bryan, Thu Oct 7 12:52:09 2004

Currently I am in the process of tracing down why Matlab sometimes gives printouts with dark backgrounds that make the page unreadable. Several ES-110 students are having the problem, but a print to win2pdf is a "quick fix", I'm looking for a better solution.

  Printing Problem

From K. Scott, Tue Sep 18 16:32:06 2001
Subject: Re: Case ID: 625340 Matlab-6 and McAfee-4.51 conflict when printing

Currently the only known workaround is to use the PRINT command from the MATLAB command line, which avoids the print dialog box. Please type "doc print" for more information. To print the command window contents, you can copy and paste it into a text editor and print it from there.

  Val's Help Sheet     (added 19 October 1999)

Written by Valerie Henson

I threw this together in an hour due to urgent demand, so forgive any errors!

Running a Script file

To run the commands in a file, first make sure that the filename has a ".m" at the end of it. Then, in the window running Matlab, type the name of your file without the .m. So if your file is named thing.m, you would type thing.

VERY IMPORTANT. This will not work unless your file is in a certain place. Read the next section to find out where this place is.

Search Paths

The search path is where Matlab looks to find a script file. In Linux it looks in /u/username/matlab, where username is your username. So, if you don't have a directory named matlab, type mkdir matlab.

Put all of your Matlab files in here, and you will be able to run them.

Changing the search path

Say you have a directory named oldstuff or something, and you want to run the Matlab files in that directory without moving them all to the matlab directory or to the desktop. For Linux, in the Matlab window type path(path,'/u/username/oldstuff'). In MS Windows, type path(path,'U:\oldstuff').

If you want it to look in your matlab directory, type path(path,'U:\matlab').

Writing a Script file

On Linux

Use whatever text editor you are used to. emacs is very versatile and convenient, but takes a while to learn. pico is very simple and similar to pine. Make sure you save your file in your matlab directory.

In MS Windows

Click on File (in the Matlab window) and go to New, select M-file. An editor will pop up and you can write your program in it. It will save your file in the default location. Don't use Notepad!!! It saves all files with a ".txt" on the end, which is NOT a ".m".

Printing a Graph

On Linux

In Matlab, if you just type print it will print whatever graph is currently displayed, but it will print it to our default printer (speare5). The best way to do it is to type print -ps name.ps where name is any name you choose. Just make sure you put the ".ps" on the end. Then go to an xterm, make sure you are in your main directory (type "cd" if you are not sure) and type, IF YOU'RE IN sPEARE 116, lpr -Pspeare116 -h name.ps.

This will print the graph currently displayed to the printer in Speare 116. The "-h" part tells it not to print a header page. If you want a header pages, leave it out. If you want to print it to a different printer, replace "speare116" with the name of the room the printer is in, like "speare4a" or "weir209".

In ms Windows

The graph will have a toolbar at the top. Click on File and go to print. Make sure the right printer is selected (or you may print to a printer in another building!) and then click OK.

The Most Frequently Asked Question

Q: I can see a file I wrote named "thing.m" on my desktop, but when I type "thing" in matlab, it can't find it!

A: If you wrote the file in Notepad, it has a ".txt" on the end of it no matter what you told Notepad to save it as. It's actually named thing.m.txt, but you can't see the ".txt" because ms Windows hides some file extensions by default. To fix this, open a DOS window and type move thing.m.txt thing.m.

To turn off hiding file extensions, double click on "My Computer". On the tool bar, click View and go to Options. In Options, click on the tab called View and unselect the option that says "Hide file extensions...".

  Color Graphs

Question:
On Apr 9, 1:56pm, James Robnett wrote
Do any of you have any experience with matlab, in particular printing color graphs?

Answer:
From Kscott, Tue Apr 9 14:04:45 1996
yup, done it several times.

/u/kscott/class/engl341/proposal/performance.m is a simple example. Once your plot is up, type print -dpsc <joerandomfilename> and you should have a color postscript file.


Next Previous Contents