Desktop Tools and Development Environment Previous page   Next Page

Defining Cell Groups for Notebook

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 the 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 undefining a cell group, see Ungroup Cells.

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 with a single pair that surrounds the group:

This is a sample cell group.

[date 
a = magic(3) ]

Note the following:

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.


Previous page  Defining MATLAB Commands as Input Cells for Notebook Defining Autoinit Input Cells for Notebook Next page

© 1994-2005 The MathWorks, Inc.