Problem launching GUI after mistakenly saving GUIDE during debugging mode

1 view (last 30 days)
Hi All,
I developed a GUI for some time using GUIDE. It is a standard GUI with Files Loading and Parsing, Graphs, Tables etc...
Basically, when launching the GUI one get clean state where all the edit text path is blank, UI tables and axes are empty and handles contain only the Figure objects, just as a regular GUI...
At some point while I was on debugging mode (BreakingPoint) I did some changes at the GUIDE (changing Tag object name, moving the position of uitable and maybe some other changes) and than I accidentally saved the GUIDE figure.
Now, every time I launch the GUI I get the Figure in the same state I saved it instead of getting the 'clean' GUI as it suppose to be in the preliminary launching.
How can I fix it?

Answers (1)

Walter Roberson
Walter Roberson on 12 Jul 2016
t = findall('type', 'uicontrol');
set(t, 'Value', 1);
t = findall('type', 'uicontrol', 'style', 'edit');
set(t, 'String', '');
t = findall('type', 'uipanel');
set(t, 'Data', []);
t = findobj('type', 'axes');
cla(t);
Execute the above, make sure that everything you want cleared has been cleared, and then you can use GUIDE to save again.
Note: in R2014a and before, clearing axes can affect colorbar and legend because they were implemented as axes. However, they were also implemented as having their handles not visible by default. When you use findobj() you only find visible axes, so they would not be found and so would not be cleared by the above code. If you were to change the code there from findobj() to findall() to match the lines above, then in those versions you will mess up your colorbars and legends.
  2 Comments
Avri
Avri on 12 Jul 2016
Edited: Avri on 12 Jul 2016
Thank you Walter.
But, the annoying thing in this problem is that even after I clean all objects it will repeat in the next time I launch the GUI.
The solution of cleaning all objects every GUI's startup is acceptable workaround but it is not the solution of the root cause...
Walter Roberson
Walter Roberson on 12 Jul 2016
When you use GUIDE to save after the above it should save with the items clear. You might need to use the GUIDE facilities to do something like move a button (and move it back) so that GUIDE knows that the configuration is "dirty".

Sign in to comment.

Categories

Find more on Migrate GUIDE Apps 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!