필터 지우기
필터 지우기

Find all Text in Tiledlayout

조회 수: 4 (최근 30일)
Frantisek Gaspar
Frantisek Gaspar 2022년 4월 13일
답변: Bhanu Prakash 2023년 10월 12일
Using function findall I tried to get handles of all Text objects in a figure. For most Text objects findall(gcf(), "Type", "text") works BUT...
In tilledlayout there are Text objects (Title, XLabel, YLabel) which are not your every day Text objects but they are 'matlab.graphics.layout.Text' which differ from the usual 'matlab.graphics.primitive.Text'. I believe this is the reason why above-mentioned findall does not return these layout.Text object handles.
Is there a general approach how to obtain REALY all object handles that can handle these special cases?
Is there at least a way to get all 'matlab.graphics.layout.Text' in a figure?

답변 (1개)

Bhanu Prakash
Bhanu Prakash 2023년 10월 12일
Hi Frantisek,
As per my understanding, you want to obtain all the 'matlab.graphics.layout.Text’ objects in a figure.
To obtains those objects, you can use the ‘findobj’ function with the ‘Type’ property in MATLAB. For example, to capture all the 'matlab.graphics.layout.Text’ objects in a figure, you can use the ‘findobj’ function as follows:
% Find all 'matlab.graphics.layout.Text' objects in the figure
TextObjs = findobj(gcf, 'Type', 'matlab.graphics.layout.Text');
% Display the handles of the layout.Text objects
disp(TextObjs);
As the function ‘findobj’ searches the objects based on their properties, you can further refine the search by adding additional properties.
For more information the ‘findobj’ function, please refer to the following documentation:

카테고리

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