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

92        Chapter 6: M-Books


                       The M-book interface allows the user to operate MATLAB from a special
                     Microsoft Word document instead of from a MATLAB Command Window. In
                     this mode, the user should think of Word as running in the foreground and
                     MATLAB as running in the background. Lines that you enter into your Word
                     document are passed to the MATLAB engine in the background and executed
                     there, whereupon the output is returned to Word (through the intermediary of

                     Visual Basic ), and then both input and output are automatically formatted.
                     One obtains a living document in the sense that one can edit the document as
                     one normally edits a word processing document. So one can revisit input lines
                     that need adjustment, change them, and reexecute on the spot — after which
                     the old outdated output is automatically overwritten with new output. The
                     graphical output that results from MATLAB graphics commands appear in
                     the Word document, immediately after the commands that generated them.
                     Erroneous input and output are easily expunged, enhanced formatting can
                     be done in a way that is no more complicated than what one does in a word
                     processor, and in the end the result of your MATLAB session can be an at-
                     tractive, easily readable, and highly informative document. Of course, one can
                     “cheat” by editing one’s output — we shall discuss that and other pitfalls and
                     strengths in what follows.


           Enabling M-Books


                     To run the M-book interface you must have Microsoft Word on your com-
                     puter. It is possible to run the interface with earlier versions of Word, but
                     we find that it works best if you have Word 97. (In fact, we find that it
                     runs better in Word 97 than it does in Word 2000, though the difference is
                     not usually significant.) The interface is enabled when you install MATLAB.
                     This is done in one of three ways depending on which version of MATLAB
                     you have. In some instances, during installation, you will be prompted to
                     enter the location of the Word executable file and the Word template direc-
                     tory. These are usually easily located; for example, on many PCs the former
                     is in MSOffice\Office\Winword.exe, and the latter is in MSOffice\
                     Templates. You may also be asked to specify a template file — in that case,
                     select normal.dot in the Templates directory. The installation program will
                     create a new template called m-book.dot, which is the Word template file as-
                     sociated withM-book documents.

                      If you don’t know where the Word files are located on your PC, go to Find
                       from the Start menu on the Task Bar, and search your hard drive for the
                       files Winword.exe and normal.dot.
   106   107   108   109   110   111   112   113   114   115   116