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.
I added a popupmenu to a uipanel. Now if want to keep the visible mode “off” for my panel, the popupmenu is still displayed. So i have to keep the visible mode “off” for my popupmenu separately. I want the popupmenu and the uipanel to act as one entity so that when I keep the visible mode “off” for the panel, the popupmenu should become invisible automatically. Is that possible?
Please contact technical support. I expect that if you configured everything correctly (using defaults) that if the popup menu were placed inside that panel it would keep the same visibility properties as you expect it should.
When you send in the request, please include the relevant files and the reproduction steps. they will take a look at it.
Doug
Leave a Reply
About
Doug Hull is a proud MathWorker who is on a mission to help you with MATLAB.
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
thanks for the post. i’m a newbie to MATLAB. I have a very basic question.
How can I bind a popupmenu to a uipanel using property inspector?
thanks,
khadija
@khadija,
Please explain what you mean in more detail.
Doug
I added a popupmenu to a uipanel. Now if want to keep the visible mode “off” for my panel, the popupmenu is still displayed. So i have to keep the visible mode “off” for my popupmenu separately. I want the popupmenu and the uipanel to act as one entity so that when I keep the visible mode “off” for the panel, the popupmenu should become invisible automatically. Is that possible?
thanks,
khadija
Khandija,
Please contact technical support. I expect that if you configured everything correctly (using defaults) that if the popup menu were placed inside that panel it would keep the same visibility properties as you expect it should.
When you send in the request, please include the relevant files and the reproduction steps. they will take a look at it.
Doug