
Defining MATLAB Commands a s Input Cells for Notebook
Defining Cell Groups for Notebook
You can col lect several input cells into a single input cell. T h is is called a cell
group. B ecaus e all the output from a cell gr oup 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 the cell group, Notebook generates a single
graphic that includes all the g raphic 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” on page 8-42 for information
about evaluating a cell group. For information about ungrouping a cell group,
see “Ungroup Cells” on page 8-61.
Creating a Cell Group for Notebook
To create a cell group,
1 Use the mouse to select the input cells that are to make up the group.
2 Select Notebook > Group Cells or press Alt+G.
Notebook converts the selected cells into a cell group and replaces cell
markers w ith a single pair that surrounds the group:
This is a sample cell group.
[date
a = magic(3) ]
Note the following:
• A cell group cannot contain output cells. If the selection includes output
cells, Notebook de lete s t h em.
• A cell group cannot contain text. If the sele ction includes text, Notebook
places the text after the cell group. However, if the text precedes the first
input cell in the selection, Notebook leaves it where it is.
8-37
Komentáře k této Příručce