필터 지우기
필터 지우기

GUI window is printed to the MS word instead of the plot

조회 수: 1 (최근 30일)
Karthik KJ
Karthik KJ 2012년 6월 25일
Hi,
I am facing a difficulty while saving a figure to MS Word using a GUI. I am opening a matlab figure and then saving it to MS word using a GUI named (MainWindow.fig). The code present within the MainWindow.fig GUI is
openfig('Fig_Step01_SiteConditions.fig');
wr.addfigure();
Fuction for addfigure is below
function AddFigure
print -dmeta
% Paste clipboard content
invoke(hdlActiveX.Selection, 'Paste'); % or Paste(hdlActiveX.Selection)
end % AddFigure
But instead of the figure named 'Fig_Step01_SiteConditions.fig', it is copying my GUI figure (MainWindow.fig) and pasting it into the MS word.
I tried to get the figure handle but could not suceed.
Aprreciate the help
Regards Karthik
  댓글 수: 1
Jan
Jan 2012년 6월 25일
Are the values and type of "wr" and "hdlActiveX" clear?

댓글을 달려면 로그인하십시오.

채택된 답변

Walter Roberson
Walter Roberson 2012년 6월 25일
h = openfig('Fig_Step01_SiteConditions.fig');
wr.addfigure(h);
function AddFigure(h)
print(h, '-meta')
[...]
end
  댓글 수: 2
Karthik KJ
Karthik KJ 2012년 6월 26일
just an addition, need to define h as global. Thank you Walter
Walter Roberson
Walter Roberson 2012년 6월 26일
h should not be defined as global with that sequence. The point of adding h into the addfigure call was to pass it to the routine.
I am, though, confused about the difference between wr.addfigure and the function AddFigure . Did you do wr.addfigure = @AddFigure or something like that?

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Historical Contests에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by