Page 115 - A Guide to MATLAB for Beginners and Experienced Users
P. 115

96        Chapter 6: M-Books


                       It is important to understand that your M-book can be handled in exactly
                     the same way that you would any Word document. In particular, you can
                     save the file, print the document, change fonts or margins, move or export a
                     graphic, etc. This has the advantage of allowing you to present the results
                     of your MATLAB session in an attractively formatted style. It also has the
                     disadvantage of affording the user the opportunity to muck with MATLAB’s
                     input or output and so to create input and output that may not truly correspond
                     to eachother. One must be very careful!

                      Note that the help item on the menu bar is Word help, not MATLAB help. If
                       you want to invoke MATLAB help, then either type help (with CTRL+ENTER
                       of course) or bring the MATLAB Command Window to the foreground (see
                       below) and use MATLAB help in the usual fashion.


           The Notebook Menu

                     Next let’s examine the items in the Notebook menu. First comes Define
                     Input Cell. If you put your cursor on any line and select Define Input Cell,
                     then that line will become an input line. But to evaluate it, you still need to
                     press CTRL+ENTER. The advantage to this item is apparent when you want to
                     create an input cell containing more than one line. For example, type
                       syms x y
                       factor(xˆ2 - yˆ2)
                     and then select both lines (by clicking and dragging over them) and choose
                     Define Input Cell. CTRL+ENTER will then cause both lines to be evaluated. You
                     can recognize that both lines are incorporated into one input cell by looking at
                     the brackets, or Cell Markers. The menu item Hide Cell Markers will cause
                     the Cell Markers to disappear; in fact that menu item is a toggle switch that
                     turns the Markers on and off. If you have several input cells, you can convert
                     them into one input cell by selecting them and choosing Group Cells. You can
                     break them apart by choosing Ungroup Cells. If you click in an input cell
                     and choose Undefine Cells, that cell ceases to be an input cell; its formatting
                     reverts to the default Word format, as does the corresponding output cell. If
                     you “undefine” an output cell, it loses its format, but the corresponding input
                     cell remains unchanged.
                       If you select some portion of your M-book (for example, the entire M-book
                     by using Edit : Select All) and then choose Purge Output Cells, all output
                     cells in the selection will be deleted. This is particularly useful if you wish
                     to change some data on which the output in your selection depends, and then
   110   111   112   113   114   115   116   117   118   119   120