Print specific figure in GUI

5 ビュー (過去 30 日間)
Maryam Emad
Maryam Emad 2011 年 11 月 29 日
コメント済み: Jan 2018 年 3 月 8 日
Welcome All
I hope to be alright :)
I make GUI in matlab , it's contain print button because i want to print specific figure in my GUI
I try that :
function pushbutton4_Callback(hObject, eventdata, handles) % hObject handle to pushbutton1 (see GCBO) % eventdata reserved - to be defined in a future version of MATLAB % handles structure with handles and user data (see GUIDATA)
% Callback function run when the Print menu item is selected
h = handles.axes2;
print(h)
but, an Error was Appear !!
Plz help me :(
  2 件のコメント
Chandra Kurniawan
Chandra Kurniawan 2011 年 11 月 29 日
What is the error message??
Maryam Emad
Maryam Emad 2011 年 11 月 29 日
??? Error using ==> print at 310
Handle Graphics handle must be a Figure.
Error in ==> Interface1>pushbutton4_Callback at 373
print(h)

サインインしてコメントする。

採用された回答

Titus Edelhofer
Titus Edelhofer 2011 年 11 月 29 日
Hi,
the error message tells you the problem: you can only print figures, not axes. I assume though, that handles.axes2 is an axes handle, not the figure handle. You probably need to have
h = handles.figure1;
instead.
Titus
  1 件のコメント
Maryam Emad
Maryam Emad 2011 年 11 月 29 日
Tq a lot
Aha , but my interface contain axes not figure ? !
how I can print axes ??
http://dc05.arabsh.com/i/03603/n1prwhtfto83.jpg

サインインしてコメントする。

その他の回答 (4 件)

Oliver Woodford
Oliver Woodford 2011 年 11 月 29 日
The export_fig package contains a function called isolate_axes. You can use this to send a specific axes to a printer as follows:
figure_handle = isolate_axes(axes_handle);
print(figure_handle, ...); % Add the correct print options here
close(figure_handle);
axes_handle can also be a vector of handles of axes in the same figure, in which case all the axes will be printed.

Daniel Shub
Daniel Shub 2011 年 11 月 29 日
  3 件のコメント
Daniel Shub
Daniel Shub 2011 年 11 月 29 日
@IA, nice catch. I fixed it.
Maryam Emad
Maryam Emad 2011 年 11 月 29 日
Sorry , What are you talking about :(
I'm beginner !

サインインしてコメントする。


Maryam Emad
Maryam Emad 2011 年 11 月 29 日
Thanks for All (f)
I mean how i can print axes appear GUI with printer device !??
and my GUI contain 2 axes.
Process done like this :
when a user click on print button the two axes goes to print ^^

Raphael Ferreira
Raphael Ferreira 2018 年 3 月 8 日
Hi, how are you? Were you able to print a specific figure in the guide? If yes, can you send the code to my emai? email: rkhayker@gmail.com I am developing my thesis and I need this function. I've been trying for two weeks. I'm grateful already!
  1 件のコメント
Jan
Jan 2018 年 3 月 8 日
Please do not hijack another thread, but open your own one. The nature of this forum is sharing solutions in public, so sending code to an email address is not the right way.
Explain in your new thread, what "print a specific figure in the guide" means, because this is not clear yet.

サインインしてコメントする。

カテゴリ

Help Center および File ExchangeGraphics Object Programming についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by