MAtlab GUI Axis tag problem (MAtlab GUI forgets to call the tag name of axis)

Hi all, Think of a GUI consisting of 2 axes, and pushbutton, editbox, panel and textbox. There are mathematical equations in the GUI and worked perfectly. In the first, there is one Axis in the GUI used to show plot the equations. Second Axis is added in order to put one picture and will be shown all the time when the program run. Everything works perfect!. But when i restart the matlab program and call the GUI, the tag of the second axis is lost and image cannot be shown on this axis. I have to right click on the axis, and choose CreateFunc and insert the following code.
Axis(hObject);
imshow('thenameofthepicture.jpg')
First, i did this. Second, image is not shown in the GUI. And everytime, i restart the Matlab, image cannot be shown until i right click on the GUI and check the code which is written (i added no code!) but, in the GUI tag of the axis is not written.
Everytime i have to insert tag name for the axis. How can i solve this tag problem? Why does Tag name inserted first time is deleted everytime i opened the GUI? Thanks...

Answers (1)

If the GUI is created in GUIDE, use the property inspector in GUIDE to give the axes a tag. After this, it should maintain its tag.

7 Comments

This what i did last time does not help. And when you build matlab GUI, you encounter great things as well as bad things cause great bugs. i think, i encountered one of them.
I have no idea what you're talking about. If you open the GUI figure file in GUIDE, double click on the axes, which will pull up the property inspecttor. Then scroll to tag, enter your tag of choice, click somewhere else to update changes, save the fig file. When you reopen the fig file in GUIDE it should still have this tag.
I have this exact issue too! using matlab 2014b. the axis are used to display images and only lose their tag when the picture is loaded. if I leave them as just plots they seem to be ok.
Are you using imshow? If you are, make sure to use the 'parent' syntax
imshow(I,'parent',handles.axes1)
Hello, I'm having exactly the same issue. The problem is that I'm using multiple axes position to set all the objects in my GUI. As soon as I upload an image into an axes (I'm using imagesc), it erases the tag of that axes.. Since I'm using the tag property to call the object, I get errors.. Is there a solution for this? Thanks in advance
@metoo! I have axes saved in my Object with a tag.
obj.Ax2.Tag
ans = 'Ax2_main'
After showing an image with imshow, the tag is lost:
imshow(bw1,'parent',obj.Ax2);
obj.Ax2.Tag
ans = 0×0 empty char array

Sign in to comment.

Categories

Find more on Creating, Deleting, and Querying Graphics Objects in Help Center and File Exchange

Asked:

on 7 Jun 2012

Edited:

on 14 Sep 2018

Community Treasure Hunt

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

Start Hunting!