MATLAB: Does adding a title to an axes change the axes position within a GUI that contains a colorbar in MATLAB 7.0.1 (R14SP1)

cellcolorbarMATLABtitle

Each time a title is added to an axes within a GUI in MATLAB 7.0.1 (R14SP1), the position of the axes will change. This behavior only occurs for GUI figures containing a colorbar, and only when the argument to the TITLE command is a cell array containing two or more string elements:
axes(handles.axes1)
imagesc(rand(256,256));
hcbar = colorbar;
str_cell{1}='example of behavior';
str_cell{2}='of behavior';
title(str_cell)

Best Answer

This bug has been fixed in Release 2007a (R2007a). For previous product releases, read below for any possible workarounds:
There is a bug in MATLAB 7.0.1 (R14SP1) when using a figure colorbar in conjunction with an axes title for axes titles containing multiple element cell array arguments.
To work around the problem, store the axes position and revert back to this position following each call to TITLE, as shown::
%store original axes position
pos_orig=get(handles.axes1,'Position');
axes(handles.axes1)
imagesc(rand(256,256));
hcbar = colorbar;
str_cell{1}='example of behavior';
str_cell{2}='of behavior';
title(str_cell)
%revert back to previous axes position
set(handles.axes1,'Position',pos_orig);