Why does the axes in my GUIDE-built GUI lose its 'tag' string when I reopen the GUI in GUIDE?

6 visualizzazioni (ultimi 30 giorni)
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).

Risposta accettata

MathWorks Support Team
MathWorks Support Team il 24 Ago 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.

Più risposte (0)

Categorie

Scopri di più su Migrate GUIDE Apps in Help Center e File Exchange

Prodotti


Release

R2009a

Community Treasure Hunt

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

Start Hunting!

Translated by