matlab GUIs

2 views (last 30 days)
ammara AMMARA
ammara AMMARA on 25 Apr 2012
I have a main GUI from which I can open several sub GUIs. I need to write a code such that when I open the sub GUIs, first sub GUI should be closed when I open the second sub GUI but the main GUI should remain open. Can anyone help me out with the code?

Accepted Answer

Jakob Sørensen
Jakob Sørensen on 25 Apr 2012
Hmm, maybe 'findobj' could work. I tried some code that seemed to work:
% Find all figures
list_of_figs = findobj('type','figure');
% The latest opened figure, should be in the end of the list.
sub_fig = list_of_figs(end);
% Close the figure
close(sub_fig);
Or you could open you sub GUI's using the same name for all of them (since you won't have more than one open at a time anyway), and then just use close(sub_fig_name).

More Answers (0)

Categories

Find more on Graphics Object Identification in Help Center and File Exchange

Tags

Community Treasure Hunt

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

Start Hunting!