Why findobj cannot find a TexBox (annotation) object?
7 ビュー (過去 30 日間)
古いコメントを表示
Kouichi C. Nakamura
2020 年 12 月 4 日
コメント済み: Kouichi C. Nakamura
2020 年 12 月 4 日
While HandleVisibility property of a TextBox object is 'on' by default,
fig = figure
txb = annotation('textbox',[0.5 0.5 0.5 0.5],'String','bar hoo')
class(txb)
ans =
'matlab.graphics.shape.TextBox'
txb.Type %
ans = 'textboxshape'
txb.HandleVisibility
ans = 'on'
findobj cannot find this txb.
findobj(fig,'Type','textboxshape')
ans =
Why is this and how can I find this txb?
0 件のコメント
採用された回答
Cris LaPierre
2020 年 12 月 4 日
編集済み: Cris LaPierre
2020 年 12 月 4 日
Try using the object handle (txb) directly.
plot(1:10)
str = 'Straight Line Plot from 1 to 10';
txb = annotation('textbox',[.2 .5 .3 .3],'String',str,'FitBoxToText','on');
% Use object handle
findobj(txb)
If you want to instead find the annotation without using the object handle, use findall instead.
findall(gcf,'Type','textboxshape')
4 件のコメント
Cris LaPierre
2020 年 12 月 4 日
Good point. The underlying issue was handle visibility, as you pointed out below. I'll update my response to remove any confusion.
その他の回答 (1 件)
参考
カテゴリ
Help Center および File Exchange で Graphics Object Programming についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!