How do I close all Biograph Viewers programmatically in MATLAB 7.8 (R2009a)?

3 visualizaciones (últimos 30 días)
I want to know how to programmatically close all the Biograph Viewers at once.

Respuesta aceptada

MathWorks Support Team
MathWorks Support Team el 13 de Jul. de 2009
The creation of a Biograph Viewer through the view command does not return the figure handle necessary to use the close function.
To close the Biograph Viewer programatically it's necessary to find the handles to the figures that are currently open and then use a string comparison to find those with 'Biograph Viewer' in the first 15 characters of the 'Name' properties.
The following code closes all the open Biograph Viewers leaving all others figures open:
% The following creates a biograph
W = [.41 .99 .51 .32 .15 .45 .38 .32 .36 .29 .21];
DG = sparse([6 1 2 2 3 4 4 5 5 6 1],[2 6 3 5 4 1 6 3 4 3 5],W);
view(biograph(DG));
% This finds handles to all the objects in the current session, filters it to find just the handles to the Biograph Viewers so that they can be selectively closed.
child_handles = allchild(0);
names = get(child_handles,'Name');
k = find(strncmp('Biograph Viewer', names, 15));
close(child_handles(k))

Más respuestas (0)

Categorías

Más información sobre Creating, Deleting, and Querying Graphics Objects en Help Center y File Exchange.

Productos


Versión

R2009a

Community Treasure Hunt

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

Start Hunting!

Translated by