Try using the object handle (txb) directly.
str = 'Straight Line Plot from 1 to 10';
txb = annotation('textbox',[.2 .5 .3 .3],'String',str,'FitBoxToText','on');
findobj(txb)
ans =
TextBox (Straight Line Plot from 1 to 10) with properties:
String: 'Straight Line Plot from 1 to 10'
FontName: 'Helvetica'
FontSize: 10
FontWeight: 'normal'
Color: [0 0 0]
BackgroundColor: 'none'
EdgeColor: [0 0 0]
LineStyle: '-'
LineWidth: 0.5000
Position: [0.2000 0.5000 0.3000 0.3000]
Units: 'normalized'
Show
all properties
If you want to instead find the annotation without using the object handle, use findall instead.
findall(gcf,'Type','textboxshape')
ans =
TextBox (Straight Line Plot from 1 to 10) with properties:
String: 'Straight Line Plot from 1 to 10'
FontName: 'Helvetica'
FontSize: 10
FontWeight: 'normal'
Color: [0 0 0]
BackgroundColor: 'none'
EdgeColor: [0 0 0]
LineStyle: '-'
LineWidth: 0.5000
Position: [0.2000 0.5000 0.3000 0.3000]
Units: 'normalized'
Show
all properties
Best Answer