Geoscience Reference
In-Depth Information
for graphics, a more practical way to modify a graph for presentations or
publications is to export the i gure and import it into a dif erent sot ware
such as CorelDraw or Adobe Illustrator. MATLAB graphics are exported by
selecting the command Save as from the File menu or by using the command
print . h is function exports the graphics, either as a raster image (e.g., JPEG
or GIF) or as a vector i le (e.g., EPS or PDF), into the working directory
(see Chapter 8 for more details on graphic i le formats). In practice, the
user should check the various combinations of export i le formats and the
graphics sot ware used for i nal editing of the graphics. Readers interested in
advanced visualization techniques with MATLAB are directed to the sister
topic MATLAB and Design Recipes for Earth Sciences (Trauth and Sillmann
2012).
2.11 Publishing M-Files
Another useful feature of the sot ware is the option to publish reports on
MATLAB projects in various i le formats such as HTML, XML, LaTeX and
many others. h is feature enables you to share your results with colleagues
who may or may not have the MATLAB sot ware. h e published code
includes formatted commentary on the code, the actual MATLAB code,
and all results of running the code including the output to the Command
Window and all graphics created or modii ed by the code. To illustrate the
use of the publishing feature we create a simple example of a commented
MATLAB code to compute the sine and cosine of a time vector and display
the results as two separate i gures.
We start the Editor by typing edit in the Command Window, which
opens a new window named untitled . An M-i le to be published starts
with a document title at the top of the i le, followed by some comments that
describe the contents and the version of the script. h e subsequent contents
of the i le include sections of MATLAB code and comments, separated by
the double percent signs %% . Whereas single percent signs % are known (from
Section 2.8) to initiate comments in MATLAB, we now use double percent
signs %% that indicate the start of new code sections in the Editor. h e code
sections feature, previously also known as code cells or cell mode , is a feature
in MATLAB that enables you to evaluate blocks of commands called sections
by using the buttons Run , Run and Advance , Run Section , Advance , and Run
and Time on the Editor Toolstrip to evaluate either the entire script or parts
of the script.
%% Example for Publishing M-Files
% This M-file illustrates the use of the publishing
% feature of MATLAB.
Search WWH ::




Custom Search