Using MATLAB (779505), страница 38
Текст из файла (страница 38)
If you print the M-book on a grayscale printer, these cells appear as shadesof gray. To print these cells using black type, you need to modify the color of theInput, Output, AutoInit, and Error styles in the M-book template.The table below describes the default styles used by Notebook. If you modifystyles, you can use the information in the tables below to help you return thestyles to their original settings. For general information about using styles inWord documents, see the Word documentation.10-18Printing and Formatting an M-BookStyleFontSizeWeightColorNormalTimes New Roman10 pointsAutoInitCourier New10 pointsBoldDark BlueErrorCourier New10 pointsBoldRedInputCourier New10 pointsBoldDark GreenOutputCourier New10 pointsBlackBlueWhen you change a style, Word applies the change to all characters in theM-book that use that style and gives you the option to change the template.
Becautious about making changes to the template. If you choose to apply thechanges to the template, you will affect all new M-books you create using thetemplate. See the Word documentation for more information.Choosing Loose or Compact FormatYou can specify whether a blank line appears between the input and outputcells by selecting Loose or Compact format.1 Click on the Notebook menu and select Notebook Options.2 In the Notebook Options dialog box, select either the Loose or Compactcheck box. Loose format adds an empty line. Compact format does not.3 Click OK.Note Changes you make using the Notebook Options dialog box take effectfor output generated after you click on the OK button. To affect existing inputor output cells, you must re-evaluate the cells.10-1910Using NotebookControlling Numeric Output FormatTo change how Notebook displays numeric output:1 Click on the Notebook menu and select Notebook Options.2 In the Notebook Options dialog box, click on the Numeric Format menu toview a list of available formats.
These settings correspond to the choicesavailable with the MATLAB format command. The figure below shows theavailable numeric formats.3 Click OK.Note Changes you make using the Notebook Options dialog box take effectfor output generated after you click on the OK button. To affect existing inputor output cells, you must re-evaluate the cells.Controlling Graphic OutputThis section describes how to control several aspects of the graphic outputproduced by MATLAB commands in an M-book, including:• “Embedding Graphic Output in the M-Book” on page 10-21• “Suppressing Graphic Output for Individual Input Cells” on page 10-21• “Sizing Graphic Output” on page 10-22• “Cropping Graphic Output” on page 10-22• “Adding White Space Around Graphic Output” on page 10-22• “Specifying Color Mode” on page 10-2310-20Printing and Formatting an M-BookEmbedding Graphic Output in the M-BookBy default, graphic output is embedded in an M-book.
To display graphicoutput in a separate figure window:1 Click on the Notebook menu and choose Notebook Options.2 In the Notebook Options dialog box, deselect the Embed Figures inM-book check box.3 Click OK.Note Embedded figures do not include Handle Graphics ® objects generatedby the uicontrol and uimenu functions.Notebook determines whether to embed a figure in the M-book by examiningthe value of the figure object’s Visible property. If the value of the property isoff, Notebook embeds the figure. If the value of this property is on, all graphicoutput is directed to the current figure window.Suppressing Graphic Output for Individual Input CellsIf an input or autoinit cell generates figure output that you want to suppress:1 Place the cursor in the input cell.2 Click on the Notebook menu and choose the Toggle Graph Output for Cellcommand.Notebook suppresses graphic output from the cell, inserting the string (nograph) after the input cell.To allow graphic output for a cell, repeat the same procedure.
Notebook allowsgraphic output from the cell and removes the (no graph) marker.10-2110Using NotebookNote The Toggle Graph Output for Cell command overrides the EmbedFigures in M-book option, if that option is set.Sizing Graphic OutputTo set the default size of embedded graphics in an M-book:1 Click on the Notebook menu and choose Notebook Options.2 In the Notebook Options dialog box, use the Height and Width fields to setthe size of graphics generated by the M-book.3 Click OK.Note Changes you make using the Notebook Options dialog box take effectfor graphic output generated after you click on the OK button.
To affectexisting input or output cells, you must re-evaluate the cells.You change the size of an existing embedded figure by selecting the figure,clicking the left mouse button anywhere in the figure, and dragging the resizehandles of the figure. If you resize an embedded figure using its handles andthen regenerate the figure, its size reverts to its original size.Cropping Graphic OutputTo crop an embedded figure to cut off areas you do not want to show:1 Select the graphic, by clicking the left mouse button anywhere in the figure.2 Hold down the Shift key.3 Drag a sizing handle toward the center of the graphic.Adding White Space Around Graphic OutputYou can add white space around an embedded figure by moving the boundariesof a graphic outward.
Select the graphic, then hold down the Shift key and draga sizing handle away from the graphic.10-22Printing and Formatting an M-BookSpecifying Color ModeIf you print graphic output that includes surfaces or patches, the output uses16-color mode by default. To use 256-color mode:1 Click on the Notebook menu and choose Notebook Options.2 Deselect the Use 16-Color Figures check box in the Notebook Optionsdialog box.3 Click OK.Note Changes you make using the Notebook Options dialog box take effectfor graphic output generated after you click on the OK button. To affectexisting input or output cells, you must re-evaluate the cells.10-2310Using NotebookConfiguring NotebookAfter you install Notebook, you must configure it.
(Notebook is installed as partof the MATLAB installation process. See the MATLAB Installation Guide forPC for more information.)To configure Notebook, typenotebook -setupin the MATLAB command window. Notebook prompts you to specify whichversion of Microsoft Word you are using.Choose your version of Microsoft Word:[1] Microsoft Word for Windows 95 (Version 7.0)[2] Microsoft Word 97[3] Microsoft Word 2000[4] Exit, making no changesMicrosoft Word Version: 2Next Notebook prompts you to specify the location of the Microsoft Wordexecutable (winword.exe) on your system.You will be presented with a dialog box.
Please use it to selectyour copy of the Microsoft Word 97 executable (winword.exe).Press any key to continue...Use this dialog box to specify the location of your Microsoft Word program.10-24Configuring NotebookWhen you click Open, Notebook prompts you to specify the name of a MicrosoftWord template file.You will be presented with a dialog box. Please use it toselect a Microsoft Word template (.dot) file in one of yourMicrosoft Word template directories.
We suggest that you specifyyour normal.dot file.Press any key to continue...Use this dialog box to specify the name of your Microsoft Word template file.When configuration is completed, Notebook outputs this message.Notebook setup is complete.10-2510Using NotebookNotebook Command ReferenceThis section provides reference information about each of the Notebookcommands, listed alphabetically. To use these commands, select them from theNotebook menu.• “Bring MATLAB to Front Command” on page 10-26• “Define Autoinit Cell Command” on page 10-26• “Define Calc Zone Command” on page 10-27• “Define Input Cell Command” on page 10-27• “Evaluate Calc Zone Command” on page 10-28• “Evaluate Cell Command” on page 10-28• “Evaluate Loop Command” on page 10-29• “Evaluate M-Book Command” on page 10-30• “Group Cells Command” on page 10-30• “Hide Cell Markers Command” on page 10-31• “Notebook Options Command” on page 10-31• “Purge Output Cells Command” on page 10-31• “Toggle Graph Output for Cell Command” on page 10-31• “Undefine Cells Command” on page 10-32• “Ungroup Cells Command” on page 10-32Bring MATLAB to Front CommandThe Bring MATLAB to Front command brings the MATLAB commandwindow to the foreground.Define Autoinit Cell CommandThe Define AutoInit Cell command creates an autoinit cell by converting thecurrent paragraph, selected text, or input cell.
An autoinit cell is an input cellthat is automatically evaluated whenever you open an M-book.ActionIf you select this command while the cursor is in a paragraph of text, Notebookconverts the entire paragraph to an autoinit cell. If you select this command10-26Notebook Command Referencewhile text is selected, Notebook converts the text to an autoinit cell.
If youselect this command while the cursor is in an input cell, Notebook converts theinput cell to an autoinit cell.FormatNotebook formats the autoinit cell using the AutoInit style, defined as bold,dark blue, 10-point Courier New.See AlsoFor more information about autoinit cells, see “Defining Autoinit Input Cells”on page 10-10.Define Calc Zone CommandThe Define Calc Zone command defines the selected text, input cells, andoutput cells as a calc zone.
A calc zone is a contiguous block of related text,input cells, and output cells that describes a specific operation or problem.ActionNotebook defines a calc zone as a Word document section, placing sectionbreaks before and after the calc zone. However, Word does not display sectionbreaks at the beginning or end of a document.See AlsoFor information about evaluating calc zones, see “Evaluating a Calc Zone” onpage 10-14.















