MATLAB Answers

Why does the colorbar have an empty string as its tag in MATLAB 6.0 (R12)?

2 views (last 30 days)
In MATLAB 5.3 (R11), when I create a colorbar, the tag is automatically set to 'Colorbar'. In MATLAB 6.0 (R12) the tag is set to an empty string. This causes problems in code that finds handles to objects based on default tags for those objects.

Accepted Answer

MathWorks Support Team
MathWorks Support Team on 27 Jun 2009
This is a bug in MATLAB 6.0 (R12). This bug has been fixed in MATLAB 6.1 (R12.1).
If you are using MATLAB 6.0 (R12), please consider these methods of finding the handle of a colorbar as a workaround.
First, you can begin with the handle. Use the following command when you create the colorbar the first time:
h = colorbar;
This way you do not have to search for the handle later. You can then set the tag to 'Colorbar' for use in other parts of your code:
If you already have the colorbar and there is no way to get a handle on it when you create it, you can use the following code:
The tick labels of a colorbar are on the right-hand side of the colorbar. Unless you are using PLOTYY or have manually set the y-axis label to be on the right in your axes, the colorbar will be the only axis in the figure window with the tick marks on the right. You can use this property to find the handle for the colorbar.


Sign in to comment.

More Answers (0)


Translated by