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

    %% Capture Contents of Figure

% Copyright 2015 The MathWorks, Inc.


%% Can't embed yet
% Create a surface plot. Capture the interior of the figure window,
% excluding the menu and tool bars.

surf(peaks)
F = getframe(gcf);

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

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