How do you specify a figure window to copy onto a word file?

1 次查看(过去 30 天)
In my code, I generate a figure of a graph through the usage of a GUI. Then, I want to save the figure as both a .fig file and as an image in a word file. The figure correctly saves as just a graph for the fig file, but when placed in the word document, the figure appears as the entire GUI screen instead of just the graph. How do I specify so that only the graph appears instead of the whole GUI screen?
Parts of the code:
Fig2 = figure;
copyobj(handles.current_graph, Fig2); %handles.current_graph is the axes graphic object of the graph
hgsave(Fig2, 'myFigure.fig');
%(lines of code to create the word document)
Fig2
% Capture current figure/model into clipboard:
print -dmeta
% Find end of document and make it the insertion point:
end_of_doc = get(ActXWord.activedocument.content,'end');
set(ActXWord.application.selection,'Start',end_of_doc);
set(ActXWord.application.selection,'End',end_of_doc);
% Paste the contents of the Clipboard:
invoke(ActXWord.Selection,'Paste');
ActXWord.Selection.TypeParagraph; %enter

回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Printing and Saving 的更多信息

产品


版本

R2016b

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by