
Overview of MATLAB Plotting
• Save the graph as a FIG-file (select Save fro m the figure File menu).
• Generate MATLAB code that can recreate the graph (select Generate
M-File from the figure File menu).
FIG-Files. FIG-files are a binary format that saves a figure in its current
state. This means that all graphics objects and property settings are stored in
thefilewhenyoucreateit. YoucanreloadthefileintoadifferentMATLAB
session, even if you are running MATLAB on a different type of computer.
When you load a FIG-file, MATLAB creates a new figure in the same state
as the one you saved.
Note that the states of a ny figure tools (i.e., any items on the toolbars) are not
saved in a FIG-file; only the contents of the graph are saved.
Generated Code. You can use the MATLAB M-code generator to create
code that recreates the graph. Unlike a FIG-file, the generated code d oes not
contain any data. You must pass appropriate data to the generated function
when you run the code.
Studying the generated code for a g raph is a good way to learn how to
program with MATLAB.
For M ore Informa tion See the print command reference page and “Saving
Your Work” in the MATLAB Graphics documentation.
Graph Components
MATLAB displays graphs in a special window known as a figure. To create
a graph, you need to define a co ordinate syste m. Therefore e very g raph is
placed within axes, which are contained by the figure.
The actual visual representation of the data is achieved with graphics objects
like lines and surfaces. These objects are drawn within the coordinate system
defined by the axes, which MATLAB automatically creates specifically to
accommodate the range of the data. The actual data is stored as properties o f
the g raphics objects.
3-5
Kommentare zu diesen Handbüchern