Tải bản đầy đủ (.pdf) (4 trang)

MATLAB and the Internet

Bạn đang xem bản rút gọn của tài liệu. Xem và tải ngay bản đầy đủ của tài liệu tại đây (117.32 KB, 4 trang )

Chapter 10
MATLAB and the
Internet
In this chapter, we discuss a number of interrelated subjects: how to use the
Internet to get additional help with MATLAB and to find MATLAB programs
for certain specific applications, how to disseminate MATLAB programs over
the Internet, and how to use MATLAB to prepare documents for posting on
the World Wide Web.
MATLAB Help on the Internet
For answers to a variety of questions about MATLAB, it pays to visit the web
site for The MathWorks,

(In MATLAB 6, the Web menu on the Desktop menu bar can take you there
automatically.) Since files on this site are moved around periodically, we won’t
tell you precisely what is located where, but we will point out a few things
to look for. First, you can find complete documentation sets for MATLAB and
all the toolboxes. This is particularly useful if you didn’t install all the docu-
mentation locally in order to save space. Second, there are lists of frequently
asked questions about MATLAB, bug reports and bug fixes, etc. Third, there is
an index of MATLAB-based books (including this one), with descriptions and
ordering information. And finally, there are libraries of M-files, developed both
by The MathWorks and by various MATLAB users, which you can download
for free. These are especially useful if you need to do a standard sort of calcu-
lation for which there are established algorithms but for which MATLAB has
no built-in M-file; in all probability, someone has written an M-file for it and
made it available. You can also find M-files and MATLAB help elsewhere on
the Internet; a search on “MATLAB” will turn up dozens of MATLAB tutorials
214
Posting MATLAB Programs and Output
215
and help pages at all levels, many based at various universities. One of these


is the web site associated with this book,
/>where you can find nearly all of the MATLAB code used in this book.
Posting MATLAB Programs and Output
To post your own MATLAB programs or output on the Web, you have a number
of options, eachwithdifferent advantages and disadvantages.
M-Files, M-Books, Reports, and HTML Files
First, since M-files (either script M-files or function M-files) are simply plain
text files, you can post them, as is, on a web site, for interested parties to down-
load. This is the simplest option, and if you’ve written a MATLAB program
that you’d like to share with the world, this is the way to do it. It’s more likely,
however, that you want to incorporate MATLAB graphics into a web page. If
this is the case, there are basically three options:
1. You can prepare your document as an M-book in Microsoft Word. After
debugging and executing your M-book, you have two options. You can
simply post the M-book on your web site, allowing viewers with a Word
installation to read it, and allowing viewers withbotha Word and a
MATLAB installation to execute it. Or you can click on File : Save As...,
and when the dialog box appears, under “Save as type”, select “Web Page
(∗.htm, ∗.html)”. This will store your entire document in HTML (HyperText
Markup Language) format for posting on the web, and will automatically
convert all of the graphics to the correct format. Once your web document
is created, you can modify it withany HTML editor (including Word itself).
2. If you’ve installed the MATLAB Report Generator, it can take your
MATLAB programs and convert them into an HTML report with embed-
ded graphics.
3. Finally, you can create your web document withyour favorite HTML editor
and add links to your MATLAB graphics. For this to work, you need to save
your graphics in a convenient format. The simplest way to do this is to
select File : Export... in your figure window. Under “Save as type” in the
dialog box that appears, you can for instance select “JPEG images (∗.jpg)”,

and the resulting JPEG file can be incorporated into the document with a
216
Chapter 10: MATLAB and the Internet
tag suchas <img src=sphere.jpg>. If you are not happy with the size
of the resulting image, you can modify it with any image editor. (Almost
any PC these days comes with one; in UNIX you can use ImageMagick
C

,
xv
C

, or many other programs.) If you are planning to modify the image
before posting it, it may be preferable to have MATLAB store the figure in
TIFF format instead; that way no resolution is lost before you begin the
editing process.

If you are an advanced MATLAB user and you want to use MATLAB as an
engine to power an interactive web site, then you might want to purchase the
MATLAB Web Server, which is designed exactly for this purpose. You can see
samples of what it can do at
/>Configuring Your Web Browser
In this section, we explain how to configure the most popular Web browsers
to display M-files in the M-file editor or to launch M-books automatically.
Microsoft Internet Explorer
If MATLAB and Word are installed on your Windows computer then Internet
Explorer

should automatically know how to open M-books. With M-files, it
may give you a choice of downloading the file or “opening” it; if you choose the

latter, it will appear in the M-file editor, a slightly stripped-down version of
the Editor/Debugger.
Netscape Navigator
The situation with Netscape Navigator

is slightly more complicated. If you
click on an M-file (withthe .m extension), it will probably appear as a plain text
file. You can save the file and then open it if you wish with the M-file editor.
On a PC (but not in UNIX) you can open the M-file editor without launch-
ing MATLAB; look for it in the MATLAB group under Start : Programs,
or else look for the executable file meditor.exe (in MATLAB 5.3 and ear-
lier, Medit.exe). If you click on an M-book (withthe .doc extension), your
browser will probably offer you a choice of opening it or saving it, unless
you have preconfigured Netscape to open it without prompting. (This
depends also on your security settings.) What program Netscape uses to open
Configuring Your Web Browser
217
Figure 10-1: The Netscape Preferences Panel.
a file is controlled by your Preferences. To make changes, select Edit : Prefer-
ences in the Netscape menu bar, find the Navigator section, and look for the
“Applications” subsection. You will see a panel that looks something like
Figure 10-1. (Its exact appearance depends on what version of Netscape you
are using and your operating system.) Look for the “Microsoft Word Document”
file type (withfile extension .doc) and, if necessary, change the program used
to open suchfiles. Typical choices would be Word or Wordpad

in Windows
and StarOffice

or PC File Viewer


in UNIX. Choices other than Word will
only allow you to view, not to execute, M-books.

Tài liệu bạn tìm kiếm đã sẵn sàng tải về

Tải bản đầy đủ ngay
×