Filter löschen
Filter löschen

Find all Text in Tiledlayout

4 Ansichten (letzte 30 Tage)
Frantisek Gaspar
Frantisek Gaspar am 13 Apr. 2022
Beantwortet: Bhanu Prakash am 12 Okt. 2023
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?

Antworten (1)

Bhanu Prakash
Bhanu Prakash am 12 Okt. 2023
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:

Kategorien

Mehr zu Graphics Object Identification finden Sie in Help Center und File Exchange

Produkte

Community Treasure Hunt

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

Start Hunting!

Translated by