plotting in gui

2 ビュー (過去 30 日間)
Rishabh Kasliwal
Rishabh Kasliwal 2011 年 5 月 11 日
Hi All,
I am trying to desing a gui interface to interactively render plots. So I have a 2x3 figure pallet. All six have the tags axes_row11,axes_row12 ...and so on. I am trying to access these axes objects (from within a callback) by the following commands:
*********************************
mydata = guihandles(hObject);
axes(mydata.axes_row11);plot(1,1)
axes(mydata.axes_row12);plot(1,2);
OR
plot(mydata.axes_row11,1,1);
plot(mydata.axes_row12,1,2);
***************************************
Question: During the 2nd call to the 'Callback' I found that both axes_row11 and axes_row12 had been deleted and cannot be accessed anymore. Initating the commands 'plot'/'axes' is somehow modifying mydata by deleting certain handles. how do i solve this problem ?
please help
thanks,
rishabh

採用された回答

Rishabh Kasliwal
Rishabh Kasliwal 2011 年 5 月 16 日
thanks you all for the suggestions. However, none worked. In the end I figured that somehow the tag field was being erased by invoking the 'plot'. So I simply did the following:
************** plot(handles.axes_row11,1,1); set(handles.axes_row11,'Tag','axes_row11') ************************* so that next time I invoked the callback, the tag was still there. thanks again

その他の回答 (3 件)

sco1
sco1 2011 年 5 月 11 日
I use
set(gcf,'CurrentAxes',handles.YourTagHere);
plot(x,y);
To switch between axes in the GUIs I make.
  1 件のコメント
Rishabh Kasliwal
Rishabh Kasliwal 2011 年 5 月 11 日
giving the same problem:
**************************************
set(gcf,'CurrentAxes',mydata.axes_row23);
plot(1,1);
set(gcf,'CurrentAxes',mydata.axes_row13);
plot(2,2);
***********************************

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


Arturo Moncada-Torres
Arturo Moncada-Torres 2011 年 5 月 13 日
Have you tried using axes?
axes(mydata.axes_row11);
plot(1,1);
axes(mydata.axes_row12);
plot(1,2);
Hope it helps ;-)

Paulo Silva
Paulo Silva 2011 年 5 月 13 日
If you are using GUIDE just do
plot(handles.axes_row11,1,1);
plot(handles.axes_row12,1,2);

カテゴリ

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

Community Treasure Hunt

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

Start Hunting!

Translated by