How to close a UIAxes window?

4 visualizaciones (últimos 30 días)
Andreas Lauridsen
Andreas Lauridsen el 4 de Mayo de 2017
Respondida: Wilson A N el 9 de Mayo de 2017
Hello.
When I create a UIAxes object, I have no ability to close the window, other than manually. The 'close' command doesn't work. I've tried setting the visibility to 'off', of the UXAxes object, and that doesn't do anything either.
I'm using the UIAxes to get around UIFigure not having an ability to print the plot.
ux = uiaxes;
p = plot(ux,app.ECGPlot);
fig1 = figure;
ax = axes;
copyobj(ux.Children,ax);
savefig( fig1,'ECG');
close(fig1,ux);
Does a command for closing the window exist?
Thanks.

Respuestas (1)

Wilson A N
Wilson A N el 9 de Mayo de 2017
As I understand you are not able to close the 'fig1' and 'ux' windows.
In order to close the 'fig1' window, you can just use the close command as shown below:
>>close(fig1)
Now to close the 'ux' window you would need to get its corresponding figure handle and then use close command on it.('ux' is now specifying axes handle)
As 'ux' is created using uiaxes, the figure handle is hidden. Now inorder to get the figure handle and close the 'ux' window follow either one of the steps given below:
1. Get the figure handle using the following command:
>> uf = ux.Parent;
Then use the close command as shown:
>> close(uf)
2. After closing 'fig1', get the figure handle of 'ux' window using the findall command as shown:
>> uf = findall(0,'Type','figure');
Now use the close command to close the 'ux' window
>> close(uf)
You can find more information on the findall command in the following link:

Categorías

Más información sobre Interactive Control and Callbacks en Help Center y File Exchange.

Etiquetas

Productos

Community Treasure Hunt

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

Start Hunting!

Translated by