findall

Finds graphics objects of all kinds, including hidden ones, by property values.

Category: Graphics > Graphics Objects

Syntax

h = findall(parent)

Returns parent and all of its descendants.

h = findall(parent, Name, Value)

Keeps only objects whose properties match, for example 'Type','line'.

Description

findall behaves like findobj but ignores HandleVisibility, so it also sees objects that are normally hidden, such as tick-label helpers or colorbar parts. Use it for thorough clean-up or inspection; use findobj for everyday searches.

Input arguments

parent
Starting object, usually a figure or axes; 0 (the root) searches all figures.
Name, Value
Property name and value to match.

Output arguments

h
Column array of matching handles.

Example

Find lines by tag

f = figure;
plot(1:3, 'Tag', 'a');
hold on
plot(3:-1:1, 'Tag', 'b');
h = findall(f, 'Type', 'line');
disp(numel(h))
disp(numel(findall(f, 'Tag', 'b')))
Output
     2
     1

See also

findobj allchild ancestor get