This was a question that came across my desk recently:
“How do I know what figure numbers are already open?”
The way to answer this is to query the “root” (always handle 0) for its children. Figures are always children of the root and are the only direct children of the root.
get(0, ‘children’)
This video discusses the question in more depth and talks about the graphics family tree.
thank you for your postings and videos. i really like them. i have now a question regarding this posting here. how can i get the handle into a variable?
i identify the figure i need using get(0,’children’) and then checking the name of the figure.
now, if i know that my figure is the nr. 5 for example, how can i get the handle to it?
handle = get(5);
set(handle,’Name’,'test’)
returns an error. handle is in this case not the handle, but the structure of the properties of the figure.
Hi Doug,
thank you for your postings and videos. i really like them. i have now a question regarding this posting here. how can i get the handle into a variable?
i identify the figure i need using get(0,’children’) and then checking the name of the figure.
now, if i know that my figure is the nr. 5 for example, how can i get the handle to it?
handle = get(5);
set(handle,’Name’,'test’)
returns an error. handle is in this case not the handle, but the structure of the properties of the figure.
thank you very much,
tom
Tomas,
In the above case, 5 is the handle. When you GET it, you are actually losing the handle that you want. Look at his example.
a = figure(1)
handle = a
notHandle = get(a)
-Doug