How do I close all Biograph Viewers programmatically in MATLAB 7.8 (R2009a)?
4 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
I want to know how to programmatically close all the Biograph Viewers at once.
Réponse acceptée
MathWorks Support Team
le 13 Juil 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))
0 commentaires
Plus de réponses (0)
Voir également
Catégories
En savoir plus sur Creating, Deleting, and Querying Graphics Objects dans Help Center et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!