プロットを含む GUI があります。このプロットでは、注釈を追加します。GUI を使用してプロット データを変更すると、古い注釈が残り、新しい注釈が古い注釈の上にプロットされます。
したがって、古い注釈を削除する必要があります。次のコードを試しましたが、効果がありません。
set(0,'showhiddenhandles','on')
% look for all axes in the figure of choice:
h_all_axes = findall(gcf,'type','axes');
% get the 'annotation layer' axes handle:
h_anno_axes = double(find(handle(h_all_axes),'-class','graph2d.annotationlayer'));
delete(h_anno_axes);
set(0,'showhiddenhandles','off');
annotationPos = [0.55 0.58 0.6 0.3];
htxtbox = annotation('textbox',annotationPos, ...
'String' ,strtextbox, ...
'FontSize' ,FontSize+1, ...
'FitBoxToText', 'on', ...
'EdgeColor', 'none', ...
'FontName' , 'Courier New');