GUI - Figure Browser
4 views (last 30 days)
Show older comments
I have a folder with ca 50 plots (.fig) and I want to display them in a simple GUI with has a next and previouse button to display one figure at a time in certain area of the GUI.
I am able to replace the axes (handles.axes_disp) in GUI once with one of figure files but when I press one of the buttons for the second time, I cannot access the handle anymore.
[Merged information from comment]
GUI handles:
Button: handles.load_btn
Display axes: handles.axes2
'fig2.fig' is supposed to appear in the display area. But after the line copyobj I am losing the handle.
function load_btn_Callback(hObject, eventdata, handles)
ImportFig=hgload('fig2.fig',struct('visible','on')); % Open fig file and get handle
ImportFigAxes=get(ImportFig,'Children'); % Get handle to axes
% Get subplot axes info
NewFig=get(handles.axes2,'Parent'); % Get new (subplot) figure handle
SubplotPos=get(handles.axes2,'Position'); % Get position of subplot axes
delete(handles.axes2); % Delete blank subplot axes
% Copy axes over to subplot
NewSubplotAxes=copyobj(ImportFigAxes,NewFig); % Copy import fig axes to subplot
set(NewSubplotAxes,'Position',SubplotPos) % Set position to orginal subplot axes
% Delete figure
delete(ImportFig); % Delete imported figure
2 Comments
Jan
on 25 Apr 2012
Without seeing the code it is impossible to guess where the error is.
The tag "matlab" is not helpful in this forum, because *all* messages have to concern Matlab.
Walter Roberson
on 25 Apr 2012
We need to see the callback of the button you are pressing, and you need to tell us which handle is disappearing and which line of the code you are detecting that at.
Accepted Answer
Walter Roberson
on 25 Apr 2012
You delete handles.axes2 but you do not set it to any new value ?
(Also remember to use guidata(hObject, handles) after you update it with a new value.)
2 Comments
More Answers (0)
See Also
Categories
Find more on Specifying Target for Graphics Output in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!