How do I close all Biograph Viewers programmatically in MATLAB 7.8 (R2009a)?
3 visualizzazioni (ultimi 30 giorni)
Mostra commenti meno recenti
I want to know how to programmatically close all the Biograph Viewers at once.
Risposta accettata
MathWorks Support Team
il 13 Lug 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 Commenti
Più risposte (0)
Vedere anche
Categorie
Scopri di più su Creating, Deleting, and Querying Graphics Objects in Help Center e File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!