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:
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.