Hello,
I'm working on a GUI in matlab and I ended up with a really strange behaviour in my code. I manage to isolate the problem in a single script, which is the following:
fig = figure('Name','Spatial modes', ...
'numbertitle', 'off', ...
'ToolBar', 'none', ...
'menu','none','units','normalized',...
'outerposition',[0 0 1 1]);
title('whatever')
for i = 1:100
set(0,'CurrentFigure',fig)
cla
imagesc(rand(10))
caxis auto
hand.im_caxis.val = caxis;
colormap hot
colorbar
axis ij equal tight
set(gca,'color','none')
title(num2str(i))
drawnow
pause(0.1)
end
If you try to run it, you will see that the axes of the figure shift to the right every time the image is updated. After a dozen of shifts, they start shrinking until they are invisible and eventually they go back to the original size.
What is going on? What am I missing?