フィルターのクリア

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 Center および File ExchangeGraphics Object Identification についてさらに検索

製品

Community Treasure Hunt

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

Start Hunting!

Translated by