How do I close all Biograph Viewers programmatically in MATLAB 7.8 (R2009a)?
2 ビュー (過去 30 日間)
古いコメントを表示
I want to know how to programmatically close all the Biograph Viewers at once.
採用された回答
MathWorks Support Team
2009 年 7 月 13 日
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 件のコメント
その他の回答 (0 件)
参考
カテゴリ
Help Center および File Exchange で Creating, Deleting, and Querying Graphics Objects についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!