GUIDE automaticlly removes my tag from axes

4 visualizaciones (últimos 30 días)
Cineva Slobozia
Cineva Slobozia el 4 de Jun. de 2011
SO the problem is like that. After closing matlab and everything MATLAB removes tag from some axes. After i open GUIDE again and open my figure, axes that have CreateFcn with
function axes3_CreateFcn(hObject, eventdata, handles)
rgb = imread('c:/snumerice/alte/labvirtualimg1.jpg');
image(rgb);
axis off
remove tag axes3 in this case from the figure. the code remains in .m file, but i have 60 figures, almost all with axes that have a image in it, and i really cant modify all the tags manually all the time. Problem simple as that. No more tag in Property inspector of that axe( the axe is still there but with no tag).
Pls help. Thx in advance

Respuesta aceptada

Matt Fig
Matt Fig el 4 de Jun. de 2011
When you call IMAGE, many axes properties are cleared. So after you call IMAGE, set the tag.
image(rgb);
axis off
set(hObject,'tag','mytag') % Set the tag to whatever you want
The other alternative would be to set the nextplot property to replacechildren. This will avoid resetting all the properties with calling IMAGE. See the doc on axes properties.
  1 comentario
Cineva Slobozia
Cineva Slobozia el 4 de Jun. de 2011
tried both of what you told me and added guidata(hObject, handles);
and it works. Thanks

Iniciar sesión para comentar.

Más respuestas (1)

Jan
Jan el 4 de Jun. de 2011
I prefer NextPlot='add':
figure;
AxesH = axes('Tag', 'myTag');
image(rand(10, 10, 3), 'Parent', AxesH);
get(AxesH, 'Tag') % Empty string!
figure;
AxesH = axes('Tag', 'myTag', 'NextPlot', 'add');
image(rand(10, 10, 3), 'Parent', AxesH);
get(AxesH, 'Tag') % myTag

Categorías

Más información sobre Creating, Deleting, and Querying Graphics Objects en Help Center y File Exchange.

Etiquetas

Community Treasure Hunt

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

Start Hunting!

Translated by