Clear Filters
Clear Filters

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

1 view (last 30 days)
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

Answers (0)

Categories

Find more on Printing and Saving in Help Center and File Exchange

Products


Release

R2016b

Community Treasure Hunt

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

Start Hunting!