Return the first ancestor of handle object h whose type matches type, where type is a character string. If type is a cell array of strings, return the first parent whose type matches any of the given type strings.
If the handle object h is of type type, return h.
If
"toplevel"
is given as a 3rd argument, return the highest parent in the object hierarchy that matches the condition, instead of the first (nearest) one.