For information about evaluating the input cells you define, see Evaluating MATLAB Commands with Notebook.
To define a MATLAB command in a Word document as an input cell, follow these steps:
Type the command into the M-book as text. For example,
This is a sample M-book. a = magic(3)
Position the cursor anywhere in the command and select Notebook > Define Input Cell or press Alt+D. If the command is embedded in a line of text, use the mouse to select it. Notebook defines the MATLAB command as an input cell:
This is a sample M-book. [a = magic(3)]
Note how Notebook changes the character font of the text in the input cell to a bold, dark green color and encloses it within cell markers. Cell markers are bold, gray brackets. They differ from the brackets used to enclose matrices by their size and weight. For information about changing these default formats, see Modifying Styles in the M-Book Template.
You can collect several input cells into a single input cell. This is called a cell group. Because all the output from a cell group appears in a single output cell that Notebook places immediately after the group, cell groups are useful when several MATLAB commands are needed, such as to fully define a graphic.
For example, if you define all the MATLAB commands that produce a graphic as a cell group and then evaluate that cell group, Notebook generates a single graphic that includes all the graphic components defined in the commands. If instead you define all the MATLAB commands that generate the graphic as separate input cells, evaluating the cells generates multiple graphic output cells.
See Evaluating Cell Groups with Notebook for information about evaluating a cell group. For information about ungrouping a cell group, see Ungroup Cells.
To create a cell group, follow these steps:
Notebook converts the selected cells into a cell group and replaces cell markers with a single pair that surrounds the group:
This is a sample cell group. [date a = magic(3) ]
[tip]Note the following:[/tip]
When you create a cell group, Notebook defines it as an input cell unless its first line is an autoinit cell, in which case Notebook defines the group as an autoinit cell.
You can use autoinit cells to specify MATLAB commands to be automatically evaluated each time an M-book is opened. This is a quick and easy way to initialize the workspace. Autoinit cells are input cells with the following additional characteristics:
Autoinit cells are otherwise identical to input cells.
You can create an autoinit cell in one of the following two ways:
See Evaluating MATLAB Commands with Notebook for information about evaluating autoinit cells.
You can partition an M-book into self-contained sections, called calc zones. A calc zone is a contiguous block of text, input cells, and output cells. Notebook inserts Microsoft Word section breaks before and after the section to define the calc zone. The section break indicators include bold, gray brackets to distinguish them from standard Word section breaks.
You can use calc zones to prepare problem sets, making each problem a separate calc zone that can be created and tested on its own. An M-book can contain any number of calc zones.
[help]Using calc zones does not affect the scope of the variables in an M-book. Variables used in one calc zone are accessible to all calc zones.[/help]
After you create the text and cells that you want to include in the calc zone, define the calc zone by following these steps:
[warning]You must select an input cell and its output cell in their entirety to include them in the calc zone.[/warning]
See Evaluating a Calc Zone with Notebook for information about evaluating a calc zone.
To convert an input cell (or an autoinit cell or a cell group) to text, follow these steps:
When Notebook converts the cell to text, it reformats the cell contents according to the Microsoft Word Normal style. For more information about M-book styles, see Modifying Styles in the M-Book Template. When you convert an input cell to text, Notebook also converts the corresponding output cell to text.