Why does the axes in my GUIDE-built GUI lose its 'tag' string when I reopen the GUI in GUIDE?
6 views (last 30 days)
Show older comments
I have created a GUI using the GUIDE tool, which includes an axes object. In these axes, I want to initialize a plot or image, which I achieve in the createFcn of the axes.
After saving the .FIG and .M files, I reopen the GUI for editing in GUIDE. However, the GUI no longer works. Looking in the Property Inspector, I can see the 'tag' property associated with the axes object have been set to '' (i.e. an empty string).
Accepted Answer
MathWorks Support Team
on 24 Aug 2011
This happens because the createFcn is intended for initialization of the properties of the uicontrols and axes.
The problem arises because of two things:
- the exact timing of the execution of these functions;
- and the fact that PLOT or IMAGE will reset the axes properties by default.
During initialization of the GUI, the createFcns are executed just before the openingFcn. When GUIDE is launched to edit a GUI, it will initialize the GUI up to (not including) the openingFcn. Since IMAGE will reset and clear axes properties (unless the command "hold on" has been used), this results in the tag and callbacks being wiped from GUIDE and the property inspector.
The solution is to use the openingFcn instead of the createFcn. This is the recommended way to initialize images and plots.
0 Comments
More Answers (0)
See Also
Categories
Find more on Migrate GUIDE Apps 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!