www.gusucode.com > matlab 案例源码 matlab代码程序 > matlab/SavingAndLoadingGraphPlotObjectsExample.m

    %% Saving and Loading GraphPlot Objects
% Use the |savefig| function to save a graph plot figure.

% Copyright 2015 The MathWorks, Inc.

s = [1 1 1 2 2 3 3 4 5 5 6 7];
t = [2 4 5 3 6 4 7 8 6 8 7 8];
G = graph(s,t);
h = plot(G);
savefig('cubegraph.fig');
clear all
close all

%%
% Use |openfig| to load the graph plot figure back into MATLAB. |openfig|
% also returns a handle to the figure, |y|.
y = openfig('cubegraph.fig');

%%
% Use the |findobj| function to locate the correct object handle using one
% of the property values. Using |findobj| allows you to continue
% manipulating the original |GraphPlot| object used to generate the figure.
h = findobj('Marker','o')