how to display the plots one by one in axes by selecting puhsbutton

1 回表示 (過去 30 日間)
ram
ram 2011 年 6 月 24 日
i have 6 plots in the form of fig file, i would like to display that plots in previous and next .....give any idea for that.. I want to display them in the axes one by one,such that user can see the previous or next image by pushing two push buttons provided. What is the best way to do this. Thanks in advance.

回答 (2 件)

Arturo Moncada-Torres
Arturo Moncada-Torres 2011 年 6 月 24 日
I would use this script. With it, you choose what .fig to import and in what axes you want to display it. After that, the rest is easy.
Suppose your .fig files are something like:
plot1.fig
plot2.fig
...
plot6.fig
Suppose also you have defined a variable where you store the current .fig index.
handles.currentFig = 1;
Then, the callbacks would be something like this:
function pushbuttonLast_Callback(hObject, eventdata, handles)
handles.output = hObject;
...
handles.currentFig = handles.currentFig - 1;
importfig(['plot' int2str(handles.currentFig) '.fig'], handles.axes);
...
guidata(hObject, handles);
function pushbuttonNext_Callback(hObject, eventdata, handles)
handles.output = hObject;
...
handles.currentFig = handles.currentFig + 1;
importfig(['plot' int2str(handles.currentFig) '.fig'], handles.axes);
...
guidata(hObject, handles);
Just remember to validate that handles.currentFig never goes under or over the total number of .fig files you have. Hope this helps =)
  4 件のコメント
Krishna Kumar
Krishna Kumar 2011 年 6 月 24 日
Why not simply use hgload,
figure(handle.axes)
hgload('...
Arturo Moncada-Torres
Arturo Moncada-Torres 2011 年 6 月 24 日
To be honest, I have not used that function =P .

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


Krishna Kumar
Krishna Kumar 2011 年 6 月 24 日

カテゴリ

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

Community Treasure Hunt

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

Start Hunting!

Translated by