Installation guide

8 Publishing Results
Entering MATLAB
Commands in an M-Book
Note A g ood way to l
earn how to use Notebook is to open the sample M-book,
Readme.doc,and
try out the various techniques described in this section. You
can find this fi
le in the
matlabroot/notebook/pc directory.
You e nter MATLAB
commands in an M -book the same way you enter text in
any o ther Word do
cument. For example, you can e nter the following text
in a Word docume
nt. The example uses text in Courier Font but you can
use any font:
Here is a sample M-book.
a = magic(3)
To execute the MA
TLAB
magic command in this document, y ou must
Define the comm
and as an input cell
Evaluate the inp
ut cell
MATLAB displays
the output of the command in the Word document in an
output cell.
Protecting the
Integrity of Your Workspace in
M-Books
When you work on
more than one M-book in a single word proce ssing s ession,
note that:
Each M-book us
es the same “copy” of MATLAB.
A ll M-books sh
are the same workspace.
If you use the s
ame variable names in more than one M-book, data used in
one M-book can
be affected by another M -book. You can protect the integrity
of your worksp
ace by specifying the
clear command as the first autoinit
cell in the M-
book.
8-34