MAtlab GUI Axis tag problem (MAtlab GUI forgets to call the tag name of axis)
Show older comments
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)
Sean de Wolski
on 7 Jun 2012
0 votes
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
Serdar
on 7 Jun 2012
Sean de Wolski
on 7 Jun 2012
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.
Serdar
on 8 Jun 2012
loesch89
on 3 Feb 2015
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.
Sean de Wolski
on 3 Feb 2015
Are you using imshow? If you are, make sure to use the 'parent' syntax
imshow(I,'parent',handles.axes1)
susana
on 30 Nov 2017
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
Mikael Agopov
on 14 Sep 2018
Edited: Mikael Agopov
on 14 Sep 2018
@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
Categories
Find more on Creating, Deleting, and Querying Graphics Objects 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!