How to move an object from one plot to another inside a GUI using GUIDE

4 ビュー (過去 30 日間)
Vivekram
Vivekram 2013 年 3 月 21 日
Hi ,
I would like to move an object from one plot to another plot within the same GUI which I have created using GUIDE. Can anyone help me please.
Thanks
Vivekram
  5 件のコメント
Image Analyst
Image Analyst 2013 年 3 月 21 日
Whatever you did to plot it the first time, why don't you just do it again in the other axes? You can then call cla reset on the first axes if you want.
Vivekram
Vivekram 2013 年 3 月 25 日
Though I apologies for my late reply, I would like to thank Image analyst for your suggestion was really helpful

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

採用された回答

Sven
Sven 2013 年 3 月 21 日
編集済み: Sven 2013 年 3 月 21 日
Vivekram, you can change any handle graphics "Parent" property. Here's a fully working example:
function F = tmpfunc()
F = figure;
ax1 = subplot(1,2,1); axis([0 10 0 1])
ax2 = subplot(1,2,2); axis([0 10 0 1])
plotH = plot(ax1,rand(10,1),'.r-');
uicontrol(F, 'String','Push Me', 'Position', [0 0 100 30],'Callback',@push_callback)
function push_callback(src,evnt)
currentParent = get(plotH,'Parent');
if currentParent==ax1
newParent=ax2;
else
newParent=ax1;
end
set(plotH,'Parent',newParent)
end
end
See the set() call at the end there? All it takes is the handle of the thing you want to move, and the handle of the thing you want to move it to.
Does this help answer your question?
  7 件のコメント
Vivekram
Vivekram 2013 年 3 月 25 日
Thanks Sven for the help. Will do as you say
Sven
Sven 2013 年 3 月 27 日
No problems Vivekram, please hit accept if your question is answered.

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

その他の回答 (0 件)

カテゴリ

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

Community Treasure Hunt

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

Start Hunting!

Translated by