How to copy a plot from a figure window to a GUI

2 ビュー (過去 30 日間)
Haitham
Haitham 2015 年 8 月 12 日
コメント済み: Haitham 2015 年 8 月 25 日
I have a callback button that does some calculations and then shows 4 graphs in 4 windows. I would like to create a new GUI that gathering all these graphs into one window. In other word, I have two GUIs and I want to pass some graphs between them. How can I do that? Thanks.

回答 (1 件)

Walter Roberson
Walter Roberson 2015 年 8 月 12 日
If you want to have a duplicate in the second location, use copyobj(). If you want to move them to the new location, set() the Parent property of the axes. (Note: if you are using legend and you are using R2014a or earlier, then Legend generates an axes with a hidden handle, so be sure to use findall() of the axes not just findobj())
  4 件のコメント
Haitham
Haitham 2015 年 8 月 12 日
I'm not sure if I get it right but I have tried this code: In the first GUI:
hfigure10 = get(figure(10));
setappdata(0,'hfigure10',hfigure10);
hfigure20 = get(figure(20));
setappdata(0,'hfigure20',hfigure20);
hfigure30 = get(figure(30));
setappdata(0,'hfigure30',hfigure30);
hfigure40 = get(figure(40));
setappdata(0,'hfigure40',hfigure40);
GUI_2_screen_results
Then in the second GUI:
axes(handles.axes1);
hfigure10 = getappdata(0,'hfigure10');
axes(handles.axes2);
hfigure20 = getappdata(0,'hfigure20');
axes(handles.axes3);
hfigure30 = getappdata(0,'hfigure30');
axes(handles.axes4);
hfigure40 = getappdata(0,'hfigure40');
After running the code, all the axes were empty and the command window shows that there are no errors in the code!
Haitham
Haitham 2015 年 8 月 25 日
Can you please have a look on this link

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

カテゴリ

Help Center および File ExchangeCreating, Deleting, and Querying Graphics Objects についてさらに検索

製品

Community Treasure Hunt

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

Start Hunting!

Translated by