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

2 visualizzazioni (ultimi 30 giorni)
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.

Risposta accettata

MathWorks Support Team
MathWorks Support Team il 27 Giu 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:
set(h,'tag','Colorbar')
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:
findobj('yaxislabel','right')
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.

Più risposte (0)

Prodotti

Community Treasure Hunt

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

Start Hunting!

Translated by