Finding handles to figure text

조회 수: 22 (최근 30일)
Matt J
Matt J 2020년 5월 13일
편집: Rik 2020년 5월 15일
I am attempting to use findobj to retrieve text objects in a plot. For some reason, this fails (R2018a,b). In the following example, I expect to retrieve handles to the axis labels, but it doesn't work.
>> plot(1:5); xlabel X; ylabel Y
>> H=findobj(gcf, '-property','Interpreter')
H =
0×0 empty GraphicsPlaceholder array.
No other property search seems to work either:
>> H=findobj(gcf, '-property','String')
H =
0×0 empty GraphicsPlaceholder array.
>> H=findobj(gcf, 'Type','Text')
H =
0×0 empty GraphicsPlaceholder array.
Does anyone know why findobj fails when used this way?

채택된 답변

Rik
Rik 2020년 5월 13일
편집: Rik 2020년 5월 15일
The doc suggests the HandleVisibility property should be on to be found. The code below returns off on my copy of R2020a. The R2018a doc also contains this statement.
plot(1:5); xlabel X; ylabel Y
H=findobj(gcf);
H(1).Children.XLabel.HandleVisibility
You can use findall instead
  댓글 수: 1
Matt J
Matt J 2020년 5월 15일
That is interesting. I wonder what motivated the decision to make text annotation handles invisible...?

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Graphics Object Identification에 대해 자세히 알아보기

태그

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by