Find all Text in Tiledlayout

1 visualización (últimos 30 días)
Frantisek Gaspar
Frantisek Gaspar el 13 de Abr. de 2022
Respondida: Bhanu Prakash el 12 de Oct. de 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?

Respuestas (1)

Bhanu Prakash
Bhanu Prakash el 12 de Oct. de 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:

Productos

Community Treasure Hunt

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

Start Hunting!

Translated by