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

    %% Capture Contents of Current Axes

% Copyright 2015 The MathWorks, Inc.


%% Can't embed yet
% Create a plot of random data. Capture the axes and return the image data.
% |getframe| captures the interior of the axes and the axes outline. It
% does not capture content that extends beyond the axes outline.

plot(rand(5))
F = getframe;

%%
% |F| is a structure with the field |cdata| that contains the image data.
%
% Use |imshow| to display the captured image data.

%% Embed this section
figure
imshow(F.cdata)