Why does image function always delete tag of axes control ?

How do I prevent this ?

4 Comments

It doesn't. Upload your program and tell us what ot do to prove to us that it does that with your program.
Also when you're editing your post, please add what version of MATLAB you're using, and what operating system. If you're using Windows, you can type psr after you type the windows key, then run the Steps Records and show us a screenshot-by-screenshot recording of what you're doing so we can see exactly what you're seeing.
Matlab versions 2015a and 2018a
Windows10
To see error ....
1. Run guide and select "GUI with Axis and Menu"
2. replace case 1 (line 91) with ...
handles.axes1.Tag = 'test'
C = [0 2 4 6; 8 10 12 14; 16 18 20 23];
image(C);
disp(['tag = ' handles.axes1.Tag]);
program displays "tag = "
axes1 is the tag. You should never add an additional field onto the tag field. It might not even be allowed, as you can see when you try to display it.
And generally, none of the fields that you see in the Property Inspector of guide should have a field created/added to them. For example, you would not add a field called "whatever" to the units field
handles.axes1.units.whatever = 'abcd'; % DO NOT do this.
I see nothing wrong in the code shown by Gerald, he does not add a field to Tag and even if he did, it's fine to assign a structure to Tag.
As per the answer I linked to in my answer below, the high-level version of image and imagesc will reset almost all axes properties by default, including the Tag property. Follow the link for various ways to solve the issue.

Sign in to comment.

 Accepted Answer

I gave a thorough explanation in a similar question recently. I suggest you look there for solutions.

More Answers (0)

Categories

Find more on Images in Help Center and File Exchange

Asked:

on 8 Nov 2018

Commented:

on 8 Nov 2018

Community Treasure Hunt

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

Start Hunting!