Why does the axes in my GUIDE-built GUI lose its 'tag' string when I reopen the GUI in GUIDE?
6 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
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).
Réponse acceptée
MathWorks Support Team
le 24 Août 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 commentaires
Plus de réponses (0)
Voir également
Catégories
En savoir plus sur Migrate GUIDE Apps dans Help Center et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!